Understrap: How to properly control $container in page templates

Created on 13 Dec 2018  路  1Comment  路  Source: understrap/understrap

Please delete anything that does not apply for you!

Issue is about..

  • [] a Question

Please tell us about your environment:

  • WordPress Version: 5.0
  • OS Version: [Windows 10]
  • Browser: [ all ]

    - Language: [PHP]

I have a question in regards to the $container variable that is on various page templates of UnderStrap. If you open up page-templates/left-sidebarpage.php, you will see the following line of code...

get_header();
$container = get_theme_mod( 'understrap_container_type' );

Then later down the page you will see this....

<div class="<?php echo esc_attr( $container ); ?> border" id="content">

What is the "expected behavior" in how you guys desire developers to change that $container value at will?

Just to show what I've researched, I see a file called theme-settings.php with the following code:

                // Container width.
        $understrap_container_type = get_theme_mod( 'understrap_container_type' );
        if ( '' == $understrap_container_type ) {
            set_theme_mod( 'understrap_container_type', 'container' );
        }

But when I change that text value from container to container-full and save. It does not reflect that change on my left-sidebarpage.php page.

Am I missing something?

Relating to this, if I wanted to reference $understrap_container_type in the form of a custom filter and change its value on my own php file (i.e. like extras.php), how should that look like? This way I don't have to mess with touching the theme-settings.php.

Most helpful comment

The container variable and conditional are there so you can control the container width from inside the WordPress admin menu theme options at Appearance > Customize > Theme Layout Settings /wp-admin/customize.php?return=%2Fwp-admin%2Fthemes.php

The options are Fixed width container or Full width container

>All comments

The container variable and conditional are there so you can control the container width from inside the WordPress admin menu theme options at Appearance > Customize > Theme Layout Settings /wp-admin/customize.php?return=%2Fwp-admin%2Fthemes.php

The options are Fixed width container or Full width container

Was this page helpful?
0 / 5 - 0 ratings

Related issues

revamperdiaries picture revamperdiaries  路  5Comments

davidshq picture davidshq  路  4Comments

holger1411 picture holger1411  路  5Comments

kmob2 picture kmob2  路  4Comments

shansmith01 picture shansmith01  路  5Comments