MODIFY Styles

This commit is contained in:
2025-08-13 08:59:42 +00:00
parent 23e613546a
commit 03e45ed783
5 changed files with 372 additions and 235 deletions

View File

@@ -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) {