Forums › Forums › Search & Filter Pro › How to title with the taxonomy name
Tagged: title
- This topic has 9 replies, 1 voice, and was last updated 4 years, 8 months ago by Anonymous.
-
Anonymous(Private) September 4, 2019 at 10:46 am #220237
Hi,
How can I give to each taxonomy filter result that is shown as an archive the title of the taxonomy.
I think on the template I should give the variable to call the taxonomy of the filter but don’t know how to do it.
Any suppport would be really appreciated.
Thank you!
Anonymous(Private) September 4, 2019 at 11:28 am #220250Thanks for the response.
I’ve done that but it doesn’t work:
<?php
//grab the active query from our search form
//replace1526
with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(3959)->current_query();
?>
<h1 class=”hjobs”><?php echo $sf_current_query; ?> jobs</h1><br>What am I doing wrong?
Thanks!
Anonymous(Private) September 4, 2019 at 12:21 pm #220260Yes,
I’m trying to figure it out. But all what I try it also removes the term.
Like, if it is “activity: ski jobs” it ends with “jobs”
Using this code:
<?php echo $sf_current_query->get_field_string(“_sft_activities”); ?> jobs
Thank you in advance!
Anonymous(Private) September 4, 2019 at 12:23 pm #220262This is the other code that I added on the template where it displays the results:
add_filter( ‘get_the_archive_title’, function ($title) {
if ( is_category() ) {
$title = single_cat_title( ”, false );
} elseif ( is_tag() ) {
$title = single_tag_title( ”, false );
} elseif ( is_author() ) {
$title = ‘<span class=”vcard”>’ . get_the_author() . ‘</span>’ ;
}
return $title;
});
?>
-
AuthorPosts