Merge branch 'master' into master
This commit is contained in:
@@ -13,6 +13,11 @@ add_filter('body_class', function (array $classes) {
|
||||
}
|
||||
}
|
||||
|
||||
/** Add a global class to everything.
|
||||
* We want it to come first, so stuff its filter does can be overridden.
|
||||
*/
|
||||
array_unshift($classes, 'app');
|
||||
|
||||
/** Add class if sidebar is active */
|
||||
if (display_sidebar()) {
|
||||
$classes[] = 'sidebar-primary';
|
||||
@@ -67,4 +72,24 @@ add_filter('comments_template', function ($comments_template) {
|
||||
$comments_template
|
||||
);
|
||||
return template_path(locate_template(["views/{$comments_template}", $comments_template]) ?: $comments_template);
|
||||
}, 100);
|
||||
|
||||
/**
|
||||
* Render WordPress searchform using Blade
|
||||
*/
|
||||
add_filter('get_search_form', function () {
|
||||
return template('partials.searchform');
|
||||
});
|
||||
|
||||
/**
|
||||
* Collect data for searchform.
|
||||
*/
|
||||
add_filter('sage/template/app/data', function ($data) {
|
||||
return $data + [
|
||||
'sf_action' => esc_url(home_url('/')),
|
||||
'sf_screen_reader_text' => _x('Search for:', 'label', 'sage'),
|
||||
'sf_placeholder' => esc_attr_x('Search …', 'placeholder', 'sage'),
|
||||
'sf_current_query' => get_search_query(),
|
||||
'sf_submit_text' => esc_attr_x('Search', 'submit button', 'sage'),
|
||||
];
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ function config($key = null, $default = null)
|
||||
*/
|
||||
function template($file, $data = [])
|
||||
{
|
||||
if (remove_action('wp_head', 'wp_enqueue_scripts', 1)) {
|
||||
if (!is_admin() && remove_action('wp_head', 'wp_enqueue_scripts', 1)) {
|
||||
wp_enqueue_scripts();
|
||||
}
|
||||
|
||||
@@ -109,10 +109,12 @@ function filter_templates($templates)
|
||||
return [
|
||||
"{$path}/{$template}.blade.php",
|
||||
"{$path}/{$template}.php",
|
||||
"{$template}.blade.php",
|
||||
"{$template}.php",
|
||||
];
|
||||
});
|
||||
})
|
||||
->concat([
|
||||
"{$template}.blade.php",
|
||||
"{$template}.php",
|
||||
]);
|
||||
})
|
||||
->filter()
|
||||
->unique()
|
||||
|
||||
@@ -13,6 +13,10 @@ use Roots\Sage\Template\BladeProvider;
|
||||
add_action('wp_enqueue_scripts', function () {
|
||||
wp_enqueue_style('sage/main.css', asset_path('styles/main.css'), false, null);
|
||||
wp_enqueue_script('sage/main.js', asset_path('scripts/main.js'), ['jquery'], null, true);
|
||||
|
||||
if (is_single() && comments_open() && get_option('thread_comments')) {
|
||||
wp_enqueue_script('comment-reply');
|
||||
}
|
||||
}, 100);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user