• Hi, I’m using GeneratePress v1.3.44.

    Does anyone know how to create a boxed layout just by using child theme’s (function.php & style.css) as I’m planning to create a custom control to achieve this with a single click via Customizer. I’ve managed to create the control.

    I know that all these can be achieved by using the default Customizer with the settings below:
    Container Width: 978 (just as example)
    Header Width: Contained
    Navigation Width: Contained
    Footer Width: Contained
    Top and Bottom Padding settings (Not available in the default Customizer)

    But how to achieve these using child theme’s CSS? Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Theme Author Tom

    (@edge22)

    CSS to achieve all of that would be pretty extensive and not compatible with the options in the Customizer.

    Instead, you’re much better filtering the defaults:

    add_filter( 'generate_option_defaults','tu_child_theme_defaults' );
    function tu_child_theme_defaults( $defaults )
    {
    	$defaults[ 'container_width' ] = '978';
    	$defaults[ 'header_layout_setting' ] = 'contained-header';
    	$defaults[ 'nav_layout_setting' ] = 'contained-nav';
    	$defaults[ 'content_layout_setting' ] = 'one-container';
    	$defaults[ 'footer_layout_setting' ] = 'contained-footer';
    	
    	return $defaults;
    }

    That way you can still change the options in the Customizer later.

    Let me know if you need more info 🙂

    Thread Starter mdazmir

    (@mdazmir)

    Hi Tom, thanks for the reply. I put your codes inside my child themes’ function.php and it doesn’t seem to affect the layout.

    Is this the correct method to do this. Sorry, my WordPress coding skill is a bit average.

    Theme Author Tom

    (@edge22)

    It will only take affect on new installations that haven’t saved any settings.

    This is so you can still override the child theme defaults if you like.

    Thread Starter mdazmir

    (@mdazmir)

    Hi Tom, is it possible to reset the saved settings as if it’s a new installation?
    Can it be done by modifying the value within generate_setting column? Below are the details:

    MySQL Table: wp_options > generate_settings

    Value:
    a:5:{s:15:”container_width”;i:1100;s:22:”content_layout_setting”;s:13:”one-container”;s:21:”header_layout_setting”;s:12:”fluid-header”;s:18:”nav_layout_setting”;s:9:”fluid-nav”;s:21:”footer_layout_setting”;s:12:”fluid-footer”;}

    Theme Author Tom

    (@edge22)

    Best way is to go to “Appearance > GeneratePress” and use the delete customizer settings button.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Boxed Layout Using Child Thme’ is closed to new replies.