Conform to new rules

This commit is contained in:
QWp6t
2015-12-27 23:42:11 -08:00
committed by Ben Word
parent 2d02544173
commit 6a4d3bd51a
12 changed files with 306 additions and 281 deletions

View File

@@ -9,45 +9,45 @@ use Roots\Sage\Template\Wrapper;
*/
add_filter('sage/display_sidebar', function ($display) {
// The sidebar will NOT be displayed if ANY of the following return true
return $display ? !in_array(true, [
is_404(),
is_front_page(),
is_page_template('template-custom.php'),
]) : $display;
return $display ? !in_array(true, [
is_404(),
is_front_page(),
is_page_template('template-custom.php'),
]) : $display;
});
/**
* Add <body> classes
*/
add_filter('body_class', function (array $classes) {
// Add page slug if it doesn't exist
if (is_single() || is_page() && !is_front_page()) {
if (!in_array(basename(get_permalink()), $classes)) {
$classes[] = basename(get_permalink());
// Add page slug if it doesn't exist
if (is_single() || is_page() && !is_front_page()) {
if (!in_array(basename(get_permalink()), $classes)) {
$classes[] = basename(get_permalink());
}
}
}
// Add class if sidebar is active
if (display_sidebar()) {
$classes[] = 'sidebar-primary';
}
// Add class if sidebar is active
if (display_sidebar()) {
$classes[] = 'sidebar-primary';
}
return $classes;
return $classes;
});
/**
* Add "… Continued" to the excerpt
*/
add_filter('excerpt_more', function () {
return ' &hellip; <a href="' . get_permalink() . '">' . __('Continued', 'sage') . '</a>';
return ' &hellip; <a href="' . get_permalink() . '">' . __('Continued', 'sage') . '</a>';
});
/**
* Use theme wrapper
*/
add_filter('template_include', function ($main) {
if (!is_string($main) || !(string) $main) {
return $main;
}
return template_wrap(new Wrapper(basename($main)));
if (!is_string($main) || !(string) $main) {
return $main;
}
return template_wrap(new Wrapper(basename($main)));
}, 109);