diff --git a/src/assets/scss/boldgrid/_bootstrap-additions.scss b/src/assets/scss/boldgrid/_bootstrap-additions.scss index 7e648db67..8e1020cf6 100644 --- a/src/assets/scss/boldgrid/_bootstrap-additions.scss +++ b/src/assets/scss/boldgrid/_bootstrap-additions.scss @@ -89,6 +89,17 @@ .container-fluid .boldgrid-section-group .boldgrid-section { margin: auto; } + +#main-wrapper.full-width.max-full-width .main .entry-content .boldgrid-section .container-fluid { + margin-left: auto; + margin-right: auto; +} + +body.blog #main-wrapper.full-width.max-full-width { + margin-left: auto; + margin-right: auto; +} + .container .container { width: auto; } diff --git a/src/includes/class-boldgrid-framework-api.php b/src/includes/class-boldgrid-framework-api.php index 42e18f109..98c6f3e32 100644 --- a/src/includes/class-boldgrid-framework-api.php +++ b/src/includes/class-boldgrid-framework-api.php @@ -151,7 +151,21 @@ public function blog_container( $classes ) { $theme_mod_type = $boldgrid_theme_framework->woo->is_woocommerce_page() ? 'bgtfw_woocommerce_container' : 'bgtfw_blog_page_container'; if ( is_single() || is_attachment() ) { $theme_mod = get_theme_mod( $theme_mod_type ); - $classes[] = empty( $theme_mod ) ? 'full-width' : 'container'; + switch ( $theme_mod ) { + case '': + $classes[] = 'full-width'; + break; + case 'container': + $classes[] = 'container'; + break; + case 'fw-contained': + $classes[] = 'full-width'; + $classes[] = 'max-full-width'; + break; + default: + $classes[] = 'container'; + break; + } } return $classes; @@ -171,7 +185,21 @@ public function page_container( $classes ) { $theme_mod_type = $boldgrid_theme_framework->woo->is_woocommerce_page() ? 'bgtfw_woocommerce_container' : 'bgtfw_blog_page_container'; if ( is_page() || ( $boldgrid_theme_framework->woo->is_woocommerce_page() && is_shop() ) ) { $theme_mod = get_theme_mod( $theme_mod_type ); - $classes[] = empty( $theme_mod ) ? 'full-width' : 'container'; + switch ( $theme_mod ) { + case '': + $classes[] = 'full-width'; + break; + case 'container': + $classes[] = 'container'; + break; + case 'fw-contained': + $classes[] = 'full-width'; + $classes[] = 'max-full-width'; + break; + default: + $classes[] = 'container'; + break; + } } return $classes; @@ -225,7 +253,22 @@ public function blog_page_container( $classes ) { } $theme_mod = get_theme_mod( $theme_mod_type ); - $classes[] = empty( $theme_mod ) ? 'full-width' : 'container'; + + switch ( $theme_mod ) { + case '': + $classes[] = 'full-width'; + break; + case 'container': + $classes[] = 'container'; + break; + case 'fw-contained': + $classes[] = 'full-width'; + $classes[] = 'max-full-width'; + break; + default: + $classes[] = 'container'; + break; + } return $classes; } diff --git a/src/includes/configs/customizer/controls/blog-page.controls.php b/src/includes/configs/customizer/controls/blog-page.controls.php index 56a53eaf9..d32b76c21 100644 --- a/src/includes/configs/customizer/controls/blog-page.controls.php +++ b/src/includes/configs/customizer/controls/blog-page.controls.php @@ -37,14 +37,43 @@ 'priority' => 35, 'default' => 'container', 'choices' => array( - 'container' => '' . esc_attr__( 'Contained', 'bgtfw' ), - '' => '' . esc_attr__( 'Full Width', 'bgtfw' ), + 'container' => '' . esc_attr__( 'Contained', 'bgtfw' ), + 'fw-contained' => '' . esc_attr__( 'Contained Full Width', 'bgtfw' ), + '' => '' . esc_attr__( 'Full Width', 'bgtfw' ), ), 'section' => 'bgtfw_pages_blog_blog_page_post_content', 'sanitize_callback' => function( $value, $settings ) { - return 'container' === $value || '' === $value ? $value : $settings->default; + if ( empty( $value ) ) { + return 'container'; + } else { + return $value; + } }, ), + 'bgtfw_blog_page_full_width_max' => array( + 'type' => 'number', + 'transport' => 'auto', + 'priority' => 40, + 'settings' => 'bgtfw_blog_page_full_width_max', + 'label' => esc_html__( 'Max Width', 'kirki' ), + 'description' => esc_html__( 'If you want full-width containers to be limited to a maximum width, enter that width here.', 'kirki' ), + 'section' => 'bgtfw_pages_blog_blog_page_post_content', + 'default' => '1920', + 'active_callback' => array( + array( + 'setting' => 'bgtfw_blog_page_container', + 'operator' => '==', + 'value' => 'fw-contained', + ), + ), + 'output' => array( + array( + 'element' => 'body.blog #main-wrapper.full-width.max-full-width', + 'property' => 'max-width', + 'units' => 'px', + ), + ), + ), 'bgtfw_pages_blog_blog_page_layout_posts_per_page' => array( 'label' => __( 'Blog Posts Per Page', 'bgtfw' ), 'tooltip' => __( 'Set how many posts display per page for your blog, categories, archives, and search pages.', 'bgtfw' ), diff --git a/src/includes/configs/customizer/controls/blog-post.controls.php b/src/includes/configs/customizer/controls/blog-post.controls.php index 38a8a80d7..250d35238 100644 --- a/src/includes/configs/customizer/controls/blog-post.controls.php +++ b/src/includes/configs/customizer/controls/blog-post.controls.php @@ -645,12 +645,17 @@ 'priority' => 40, 'default' => 'container', 'choices' => array( - 'container' => '' . esc_attr__( 'Contained', 'bgtfw' ), - '' => '' . esc_attr__( 'Full Width', 'bgtfw' ), + 'container' => '' . esc_attr__( 'Contained', 'bgtfw' ), + 'fw-contained' => '' . esc_attr__( 'Contained Full Width', 'bgtfw' ), + '' => '' . esc_attr__( 'Full Width', 'bgtfw' ), ), 'section' => 'bgtfw_pages_blog_posts_container', 'sanitize_callback' => function( $value, $settings ) { - return 'container' === $value || '' === $value ? $value : $settings->default; + if ( empty( $value ) ) { + return 'container'; + } else { + return $value; + } }, 'js_vars' => array( array( @@ -661,6 +666,29 @@ ), ), ), + 'bgtfw_blog_posts_full_width_max' => array( + 'type' => 'number', + 'transport' => 'auto', + 'settings' => 'bgtfw_blog_posts_full_width_max', + 'label' => esc_html__( 'Max Width', 'bgtfw' ), + 'description' => esc_html__( 'If you want full-width containers to be limited to a maximum width, enter that width here.', 'kirki' ), + 'section' => 'bgtfw_pages_blog_posts_container', + 'default' => '1920', + 'active_callback' => array( + array( + 'setting' => 'bgtfw_blog_posts_container', + 'operator' => '==', + 'value' => 'fw-contained', + ), + ), + 'output' => array( + array( + 'element' => 'body.single #main-wrapper.max-full-width .main .entry-content .boldgrid-section .container-fluid', + 'property' => 'max-width', + 'units' => 'px', + ), + ), + ), 'bgtfw_layout_blog' => array( 'settings' => 'bgtfw_layout_blog', 'label' => esc_html__( 'Sidebar Display', 'bgtfw' ), diff --git a/src/includes/configs/customizer/controls/pages.controls.php b/src/includes/configs/customizer/controls/pages.controls.php index 4a3849896..c6c12c6fb 100644 --- a/src/includes/configs/customizer/controls/pages.controls.php +++ b/src/includes/configs/customizer/controls/pages.controls.php @@ -19,12 +19,17 @@ 'priority' => 35, 'default' => 'container', 'choices' => array( - 'container' => '' . esc_attr__( 'Contained', 'bgtfw' ), - '' => '' . esc_attr__( 'Full Width', 'bgtfw' ), + 'container' => '' . esc_attr__( 'Contained', 'bgtfw' ), + 'fw-contained' => '' . esc_attr__( 'Contained Full Width', 'bgtfw' ), + '' => '' . esc_attr__( 'Full Width', 'bgtfw' ), ), 'section' => 'bgtfw_layout_page_container', 'sanitize_callback' => function( $value, $settings ) { - return 'container' === $value || '' === $value ? $value : $settings->default; + if ( empty( $value ) ) { + return 'container'; + } else { + return $value; + } }, 'js_vars' => array( array( @@ -42,6 +47,29 @@ ), ), ), + 'bgtfw_pages_full_width_max' => array( + 'type' => 'number', + 'transport' => 'auto', + 'settings' => 'bgtfw_pages_full_width_max', + 'label' => esc_html__( 'Max Width', 'kirki' ), + 'description' => esc_html__( 'If you want full-width containers to be limited to a maximum width, enter that width here.', 'kirki' ), + 'section' => 'bgtfw_layout_page_container', + 'default' => '1920', + 'active_callback' => array( + array( + 'setting' => 'bgtfw_pages_container', + 'operator' => '==', + 'value' => 'fw-contained', + ), + ), + 'output' => array( + array( + 'element' => 'body.page #main-wrapper.max-full-width .main .entry-content .boldgrid-section .container-fluid', + 'property' => 'max-width', + 'units' => 'px', + ), + ), + ), 'bgtfw_pages_title_display' => array( 'type' => 'radio-buttonset', 'settings' => 'bgtfw_pages_title_display',