astra_is_content_style_boxed( mixed $post_id = false )
Checks whether content style is boxed for current layout.
Description
Parameters
- $post_id
-
(mixed) (Optional) Current post ID.
Default value: false
Return
(bool)
Source
File: inc/markup-extras.php
function astra_is_content_style_boxed( $post_id = false ) {
$post_type = strval( get_post_type() );
$blog_type = is_singular() ? 'single' : 'archive';
$global_content_style = astra_get_option( 'site-content-style' );
$meta_content_style = astra_get_option_meta( 'site-content-style', '', true );
$is_boxed = false;
$is_third_party_shop = false;
// Editor compatibility.
if ( $post_id ) {
$blog_type = 'single';
$meta_content_style = get_post_meta( $post_id, 'site-content-style', true );
}
$content_style = astra_get_option( $blog_type . '-' . $post_type . '-content-style', '' );
// Third party compatibility.
$third_party = astra_with_third_party();
if ( ! empty( $third_party ) ) {
$third_party_content_style = astra_get_option( $third_party . '-content-style', '' );
if ( in_array( $third_party, array( 'lifterlms', 'learndash' ) ) && ! in_array( $post_type, Astra_Posts_Structure_Loader::get_supported_post_types() ) && empty( $meta_content_style ) ) {
$blog_type = '';
}
// Get global content style if third party is default.
$global_content_style = ( 'default' === $third_party_content_style || empty( $third_party_content_style ) ) ? $global_content_style : $third_party_content_style;
// Woo Cart & Checkout Page
if ( 'woocommerce' === $third_party && ( is_cart() || is_checkout() ) ) {
return ( 'boxed' === $global_content_style );
}
// Third party shop/archive page meta case.
$third_party_meta_page = astra_third_party_archive_meta( 'site-content-style' );
$meta_content_style = isset( $third_party_meta_page ) && $third_party_meta_page ? $third_party_meta_page : $meta_content_style;
$is_third_party_shop = isset( $third_party_meta_page ) && $third_party_meta_page ? true : false;
}
// Global.
if ( 'boxed' === $global_content_style ) {
$is_boxed = true;
}
// Archive.
if ( 'archive' === $blog_type && ! empty( $content_style ) && 'default' !== $content_style ) {
$is_boxed = ( 'boxed' === $content_style );
}
// Single.
if ( 'single' === $blog_type && ! empty( $content_style ) && 'default' !== $content_style ) {
$is_boxed = ( 'boxed' === $content_style );
}
// Meta.
if ( ( 'single' === $blog_type || $is_third_party_shop ) && ! empty( $meta_content_style ) && 'default' !== $meta_content_style && ! $post_id ) {
if ( 'boxed' === $meta_content_style ) {
$is_boxed = true;
} else {
$is_boxed = false;
}
}
return $is_boxed;
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 4.2.0 | Introduced. |