Changeset 52161 for trunk/src/wp-includes/blocks
- Timestamp:
- 11/15/2021 12:47:22 PM (4 years ago)
- Location:
- trunk/src/wp-includes/blocks
- Files:
-
- 2 edited
-
calendar.php (modified) (1 diff)
-
navigation.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/calendar.php
r52042 r52161 108 108 } 109 109 110 // We only want to register these functions and actions when 111 // we are on single sites. On multi sites we use `post_count` option. 112 if ( ! is_multisite() ) { 113 /** 114 * Handler for updating the has published posts flag when a post is deleted. 115 * 116 * @param int $post_id Deleted post ID. 117 */ 118 function block_core_calendar_update_has_published_post_on_delete( $post_id ) { 119 $post = get_post( $post_id ); 120 121 if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) { 122 return; 123 } 124 125 block_core_calendar_update_has_published_posts(); 110 /** 111 * Handler for updating the has published posts flag when a post is deleted. 112 * 113 * @param int $post_id Deleted post ID. 114 */ 115 function block_core_calendar_update_has_published_post_on_delete( $post_id ) { 116 if ( is_multisite() ) { 117 return; 126 118 } 127 119 128 /** 129 * Handler for updating the has published posts flag when a post status changes. 130 * 131 * @param string $new_status The status the post is changing to. 132 * @param string $old_status The status the post is changing from. 133 * @param WP_Post $post Post object. 134 */ 135 function block_core_calendar_update_has_published_post_on_transition_post_status( $new_status, $old_status, $post ) { 136 if ( $new_status === $old_status ) { 137 return; 138 } 120 $post = get_post( $post_id ); 139 121 140 if ( 'post' !== get_post_type( $post ) ) { 141 return; 142 } 143 144 if ( 'publish' !== $new_status && 'publish' !== $old_status ) { 145 return; 146 } 147 148 block_core_calendar_update_has_published_posts(); 122 if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) { 123 return; 149 124 } 150 125 151 add_action( 'delete_post', 'block_core_calendar_update_has_published_post_on_delete' ); 152 add_action( 'transition_post_status', 'block_core_calendar_update_has_published_post_on_transition_post_status', 10, 3 ); 126 block_core_calendar_update_has_published_posts(); 153 127 } 128 129 /** 130 * Handler for updating the has published posts flag when a post status changes. 131 * 132 * @param string $new_status The status the post is changing to. 133 * @param string $old_status The status the post is changing from. 134 * @param WP_Post $post Post object. 135 */ 136 function block_core_calendar_update_has_published_post_on_transition_post_status( $new_status, $old_status, $post ) { 137 if ( is_multisite() ) { 138 return; 139 } 140 141 if ( $new_status === $old_status ) { 142 return; 143 } 144 145 if ( 'post' !== get_post_type( $post ) ) { 146 return; 147 } 148 149 if ( 'publish' !== $new_status && 'publish' !== $old_status ) { 150 return; 151 } 152 153 block_core_calendar_update_has_published_posts(); 154 } 155 156 add_action( 'delete_post', 'block_core_calendar_update_has_published_post_on_delete' ); 157 add_action( 'transition_post_status', 'block_core_calendar_update_has_published_post_on_transition_post_status', 10, 3 ); -
trunk/src/wp-includes/blocks/navigation.php
r52103 r52161 148 148 if ( ! empty( $block->context['navigationArea'] ) ) { 149 149 $area = $block->context['navigationArea']; 150 $mapping = get_option( ' fse_navigation_areas', array() );150 $mapping = get_option( 'wp_navigation_areas', array() ); 151 151 if ( ! empty( $mapping[ $area ] ) ) { 152 152 $attributes['navigationMenuId'] = $mapping[ $area ]; … … 180 180 return ''; 181 181 } 182 183 // Restore legacy classnames for submenu positioning. 184 $layout_class = ''; 185 if ( isset( $attributes['layout']['justifyContent'] ) ) { 186 if ( 'right' === $attributes['layout']['justifyContent'] ) { 187 $layout_class .= 'items-justified-right'; 188 } elseif ( 'space-between' === $attributes['layout']['justifyContent'] ) { 189 $layout_class .= 'items-justified-space-between'; 190 } 191 } 192 182 193 $colors = block_core_navigation_build_css_colors( $attributes ); 183 194 $font_sizes = block_core_navigation_build_css_font_sizes( $attributes ); … … 185 196 $colors['css_classes'], 186 197 $font_sizes['css_classes'], 187 $is_responsive_menu ? array( 'is-responsive' ) : array() 198 $is_responsive_menu ? array( 'is-responsive' ) : array(), 199 $layout_class ? array( $layout_class ) : array() 188 200 ); 189 201
Note: See TracChangeset
for help on using the changeset viewer.