astra_apply_boxed_layouts( mixed $content_layout, boolean $is_boxed, boolean $is_sidebar_boxed, mixed $post_id = false )
Switch to legacy boxed layouts (Content Boxed, Boxed) as per content style selection.
Description
Parameters
- $content_layout
-
(mixed) (Required) Current layout.
- $is_boxed
-
(boolean) (Required) Current content style.
- $is_sidebar_boxed
-
(boolean) (Required) Current sidebar style.
- $post_id
-
(mixed) (Optional) Current post ID.
Default value: false
Return
(mixed) The content layout.
Source
File: inc/markup-extras.php
function astra_apply_boxed_layouts( $content_layout, $is_boxed, $is_sidebar_boxed, $post_id = false ) { // Getting meta values here to handle meta migration cases. $meta_old_layout = is_singular() ? astra_get_option_meta( 'site-content-layout', '', true ) : ''; $meta_new_layout = astra_get_option_meta( 'ast-site-content-layout', '', true ); // To check whether migrated user or not. $meta_key = astra_get_option_meta( 'astra-migrate-meta-layouts', '', true ); $migrated_user = ( ! Astra_Dynamic_CSS::astra_fullwidth_sidebar_support() ); $sidebar_layout = astra_page_layout(); // Editor compatibility. if ( $post_id ) { $meta_old_layout = get_post_meta( $post_id, 'site-content-layout', true ); $meta_new_layout = get_post_meta( $post_id, 'ast-site-content-layout', true ); $meta_key = get_post_meta( $post_id, 'astra-migrate-meta-layouts', true ); $post_type = strval( get_post_type() ); $sidebar_layout = astra_get_sidebar_layout_for_editor( $post_type ); } // Third party archive meta migration. $third_party_meta_page = astra_third_party_archive_meta( 'site-content-layout' ); if ( false !== $third_party_meta_page && $migrated_user ) { $meta_old_layout = $third_party_meta_page; $meta_key = astra_third_party_archive_meta( 'astra-migrate-meta-layouts' ); } // Migrate old user existing container layout option to new layout options. if ( $meta_old_layout && 'set' !== $meta_key && $migrated_user ) { if ( 'plain-container' == $meta_old_layout && 'plain-container' === $content_layout ) { // No need to evaluate further as no boxed (content or boxed) layout will be applicable now. return $content_layout; } elseif ( 'content-boxed-container' == $meta_old_layout && 'plain-container' === $content_layout ) { $is_boxed = true; $is_sidebar_boxed = false; } elseif ( 'boxed-container' == $meta_old_layout && 'plain-container' === $content_layout ) { $is_boxed = true; $is_sidebar_boxed = true; } } // Apply content boxed layout or boxed layout depending on content/sidebar style. if ( 'plain-container' === $content_layout ) { if ( 'no-sidebar' === $sidebar_layout ) { if ( $is_boxed ) { $content_layout = 'boxed-container'; } } elseif ( 'no-sidebar' !== $sidebar_layout ) { if ( $is_boxed ) { $content_layout = $is_sidebar_boxed ? 'boxed-container' : 'content-boxed-container'; } elseif ( $is_sidebar_boxed ) { /** * Case: unboxed container with sidebar boxed * Container unboxed css is applied through astra_apply_unboxed_container() */ $content_layout = 'boxed-container'; } } } return $content_layout; }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
4.2.0 | Introduced. |