MODIFY Styles
This commit is contained in:
@@ -32,6 +32,7 @@ class StarterSite extends Site {
|
||||
add_filter('upload_mimes', [$this, 'add_svg_support']); //add svg files
|
||||
add_filter('timber/context', [$this, 'add_global_context']); // variables globales
|
||||
add_filter('timber/twig', [$this, 'add_videos_embed_to_twig']); //videos embed
|
||||
add_action('pre_get_posts', array($this, 'exclude_pages_from_search')); //exclude pages with ACF
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
@@ -554,6 +555,24 @@ class StarterSite extends Site {
|
||||
return $afiliateFields;
|
||||
}
|
||||
|
||||
public function exclude_pages_from_search($query) {
|
||||
if (!is_admin() && $query->is_main_query() && $query->is_search()) {
|
||||
$query->set('meta_query', array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'exclude_from_search',
|
||||
'compare' => 'NOT EXISTS'
|
||||
),
|
||||
array(
|
||||
'key' => 'exclude_from_search',
|
||||
'value' => '1',
|
||||
'compare' => '!='
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Global variables
|
||||
public function add_global_context($context) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user