I have this apply filter in my plugin.
$pre_html = apply_filters( 'events_views_html', null, $view_slug, $query, $context );
I want to change $view_slug
value dynamically from child theme using add_filter
because I do not want to modify plugin files. But this code is not working. It is displaying value of $view_slug
instead of displaying complete page content.
function add_extra_val( $view_slug, $query, $context ){
if (is_singular('tribe_events')) {
$view_slug = 'single-event';
}
return $view_slug;
}
add_filter('events_views_html', 'add_extra_val', 10, 3);
It is a basic question but I have limited knowledge of WordPress filters and hooks. Some guidelines regarding this will be appreciated.