equal
deleted
inserted
replaced
21 'hierarchical' => ! empty( $attributes['showHierarchy'] ), |
21 'hierarchical' => ! empty( $attributes['showHierarchy'] ), |
22 'orderby' => 'name', |
22 'orderby' => 'name', |
23 'show_count' => ! empty( $attributes['showPostCounts'] ), |
23 'show_count' => ! empty( $attributes['showPostCounts'] ), |
24 'title_li' => '', |
24 'title_li' => '', |
25 ); |
25 ); |
|
26 if ( ! empty( $attributes['showOnlyTopLevel'] ) && $attributes['showOnlyTopLevel'] ) { |
|
27 $args['parent'] = 0; |
|
28 } |
26 |
29 |
27 if ( ! empty( $attributes['displayAsDropdown'] ) ) { |
30 if ( ! empty( $attributes['displayAsDropdown'] ) ) { |
28 $id = 'wp-block-categories-' . $block_id; |
31 $id = 'wp-block-categories-' . $block_id; |
29 $args['id'] = $id; |
32 $args['id'] = $id; |
30 $args['show_option_none'] = __( 'Select Category' ); |
33 $args['show_option_none'] = __( 'Select Category' ); |
31 $wrapper_markup = '<div %1$s><label class="screen-reader-text" for="' . $id . '">' . __( 'Categories' ) . '</label>%2$s</div>'; |
34 $wrapper_markup = '<div %1$s><label class="screen-reader-text" for="' . esc_attr( $id ) . '">' . __( 'Categories' ) . '</label>%2$s</div>'; |
32 $items_markup = wp_dropdown_categories( $args ); |
35 $items_markup = wp_dropdown_categories( $args ); |
33 $type = 'dropdown'; |
36 $type = 'dropdown'; |
34 |
37 |
35 if ( ! is_admin() ) { |
38 if ( ! is_admin() ) { |
36 // Inject the dropdown script immediately after the select dropdown. |
39 // Inject the dropdown script immediately after the select dropdown. |