Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add control for 'contained full width' #545

Merged
merged 1 commit into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/assets/scss/boldgrid/_bootstrap-additions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
49 changes: 46 additions & 3 deletions src/includes/class-boldgrid-framework-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
35 changes: 32 additions & 3 deletions src/includes/configs/customizer/controls/blog-page.controls.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,43 @@
'priority' => 35,
'default' => 'container',
'choices' => array(
'container' => '<span class="icon-layout-container"></span>' . esc_attr__( 'Contained', 'bgtfw' ),
'' => '<span class="icon-layout-full-screen"></span>' . esc_attr__( 'Full Width', 'bgtfw' ),
'container' => '<span class="icon-layout-container"></span>' . esc_attr__( 'Contained', 'bgtfw' ),
'fw-contained' => '<span class="icon-layout-full-screen"></span>' . esc_attr__( 'Contained Full Width', 'bgtfw' ),
'' => '<span class="icon-layout-full-screen"></span>' . 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' ),
Expand Down
34 changes: 31 additions & 3 deletions src/includes/configs/customizer/controls/blog-post.controls.php
Original file line number Diff line number Diff line change
Expand Up @@ -645,12 +645,17 @@
'priority' => 40,
'default' => 'container',
'choices' => array(
'container' => '<span class="icon-layout-container"></span>' . esc_attr__( 'Contained', 'bgtfw' ),
'' => '<span class="icon-layout-full-screen"></span>' . esc_attr__( 'Full Width', 'bgtfw' ),
'container' => '<span class="icon-layout-container"></span>' . esc_attr__( 'Contained', 'bgtfw' ),
'fw-contained' => '<span class="icon-layout-full-screen"></span>' . esc_attr__( 'Contained Full Width', 'bgtfw' ),
'' => '<span class="icon-layout-full-screen"></span>' . 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(
Expand All @@ -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' ),
Expand Down
34 changes: 31 additions & 3 deletions src/includes/configs/customizer/controls/pages.controls.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@
'priority' => 35,
'default' => 'container',
'choices' => array(
'container' => '<span class="icon-layout-container"></span>' . esc_attr__( 'Contained', 'bgtfw' ),
'' => '<span class="icon-layout-full-screen"></span>' . esc_attr__( 'Full Width', 'bgtfw' ),
'container' => '<span class="icon-layout-container"></span>' . esc_attr__( 'Contained', 'bgtfw' ),
'fw-contained' => '<span class="icon-layout-full-screen"></span>' . esc_attr__( 'Contained Full Width', 'bgtfw' ),
'' => '<span class="icon-layout-full-screen"></span>' . 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(
Expand All @@ -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',
Expand Down