Merge pull request #1196 from QWp6t/master
Store display_sidebar in static variable
This commit is contained in:
@@ -34,31 +34,36 @@ add_filter('body_class', 'roots_sidebar_body_class');
|
|||||||
* See lib/sidebar.php for more details
|
* See lib/sidebar.php for more details
|
||||||
*/
|
*/
|
||||||
function roots_display_sidebar() {
|
function roots_display_sidebar() {
|
||||||
$sidebar_config = new Roots_Sidebar(
|
static $display;
|
||||||
/**
|
|
||||||
* Conditional tag checks (http://codex.wordpress.org/Conditional_Tags)
|
|
||||||
* Any of these conditional tags that return true won't show the sidebar
|
|
||||||
*
|
|
||||||
* To use a function that accepts arguments, use the following format:
|
|
||||||
*
|
|
||||||
* array('function_name', array('arg1', 'arg2'))
|
|
||||||
*
|
|
||||||
* The second element must be an array even if there's only 1 argument.
|
|
||||||
*/
|
|
||||||
array(
|
|
||||||
'is_404',
|
|
||||||
'is_front_page'
|
|
||||||
),
|
|
||||||
/**
|
|
||||||
* Page template checks (via is_page_template())
|
|
||||||
* Any of these page templates that return true won't show the sidebar
|
|
||||||
*/
|
|
||||||
array(
|
|
||||||
'template-custom.php'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return apply_filters('roots/display_sidebar', $sidebar_config->display);
|
if (!isset($display)) {
|
||||||
|
$sidebar_config = new Roots_Sidebar(
|
||||||
|
/**
|
||||||
|
* Conditional tag checks (http://codex.wordpress.org/Conditional_Tags)
|
||||||
|
* Any of these conditional tags that return true won't show the sidebar
|
||||||
|
*
|
||||||
|
* To use a function that accepts arguments, use the following format:
|
||||||
|
*
|
||||||
|
* array('function_name', array('arg1', 'arg2'))
|
||||||
|
*
|
||||||
|
* The second element must be an array even if there's only 1 argument.
|
||||||
|
*/
|
||||||
|
array(
|
||||||
|
'is_404',
|
||||||
|
'is_front_page'
|
||||||
|
),
|
||||||
|
/**
|
||||||
|
* Page template checks (via is_page_template())
|
||||||
|
* Any of these page templates that return true won't show the sidebar
|
||||||
|
*/
|
||||||
|
array(
|
||||||
|
'template-custom.php'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$display = apply_filters('roots/display_sidebar', $sidebar_config->display);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $display;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user