Tagged: Post Tags
Hi Enfold users
I need to replace the default title of the blog with something dynamic, either a category or a tag.
I have started another thread to ask for help with categories, and this one is asking for help with tags.
Currently I have a function that returns the ‘Array’. I will only make 1 tag per posts (this tag will be different on different posts, not one tag common to all), and would like to have the ‘name’ of that one tag become the title of the blog.
add_filter(‘avf_title_args’, ‘fix_single_post_title’, 10, 2);
function fix_single_post_title($args,$id)
{
if ( $args[‘title’] == ‘Blog – Latest News’ )
{
$args[‘title’] = get_the_tags($id);
$args[‘heading’] = ‘h1’;
}
return $args;
}
Any ideas would be greatly appreciated.
Thank you
Darryl
Hey itchybrain!
It’s pretty much the exact same problem as with your other post. Just copy the format I showed you there but with the get_the_tags() function, https://codex.wordpress.org/Function_Reference/get_the_tags.
Best regards,
Elliott
Ah! Thanks Elliot…I did work that out after seeng the solution from your other comment: https://kriesi.at/support/topic/replace-blog-title-with-category-of-each-post/#post-474964
Very much appreciated!
cheers
Darryl