-
Notifications
You must be signed in to change notification settings - Fork 0
Changing Available Layouts And Default Layout
Steve Rudolfi edited this page May 29, 2019
·
2 revisions
Responsive Framework ships with four layout options by default:
default
top-nav
side-nav
no-nav
mega-nav
default
is the default option when:
- The
BU_RESPONSIVE_LAYOUT
constant is not defined. - The
BU_RESPONSIVE_LAYOUT
constant is defined, but is not a valid layout. - The
burf_setting_layout
option is not saved in the database (no one has used the Customizer to change the layout setting).
It is possible to add layout options based on the needs of the site.
<?php
/**
* Add a new responsive layout option.
*
* @param array List of layout options.
*
* @return array Modified layout options.
*/
function mytheme_responsive_layout_options( $layout_options ) {
$layout_options['my-custom-layout'] = __( 'My Custom Layout', 'mytheme' );
return $layout_options;
}
add_filter( 'responsive_layout_options', 'mytheme_responsive_layout_options' );
It is also possible to remove layout options based on the needs of the site.
<?php
/**
* Remove the `no-nav` responsive layout option.
*
* @param array List of layout options.
*
* @return array Modified layout options.
*/
function mytheme_responsive_layout_options( $layout_options ) {
unset( $layout_options['no-nav'] );
return $layout_options;
}
add_filter( 'responsive_layout_options', 'mytheme_responsive_layout_options' );
There could be a situation where a layout should remain an option in the
Customizer, but a different default should be enforced. Say you are building a
companion theme and instead of default
being the default, top-nav
should be
the default.
<?php
/**
* Change the default responsive layout.
*
* @param string Default responsive layout.
*
* @return string New default responsive layout.
*/
function mytheme_responsive_layout_default( $default_layout ) {
return 'top-nav';
}
add_filter( 'responsive_layout_default', 'mytheme_responsive_layout_default' );
Get started
Configuration
Build child themes
- Customizing CSS in a child theme
- Overriding templates in a child theme
- Code patterns
- Code reviews
- Pulling in Foundation Updates
- Merging and Creating a Pull Request
Sass
Javascript
PHP
- Coding Standards
- PHP Constants
- Temp PHP Code Patterns
- PHP Snippets
- How to Use Hooks
- Action Hooks
- Using Action Hooks To Output Markup
- Filter Hooks
Shortcodes
Templates
GitHub
Tasks
Contribute to the framework
- Framework Development and Release Workflows
- Documentation Template
- Testing your changes
- Creating a new release
- Migration Guide
- Needs Documentation
Code Examples
- Adding Content Container Classes
- Adding News Templates
- Adding Script Dependencies
- Changing Available Layouts and Default Layout
- Displaying a Fancy Gallery
- Loading a Custom Build of Modernizr
- Loading Modernizr in the Footer
- Using Action Hooks To Output Markup
- Understanding get_template_part
BU Developer Resources