Hello!
How can I change the Tag page header text to show the actual tag selected? I have tags set up for posts by individual authors, but when someone clicks to view Posts by Jim, the header on the Tag page says just “Posts”– it shows just the posts by Jim, but the header doesn’t say that. I would like it to say “Posts by Jim” if that is the tag they select.
Links are below. Hope there is a way to do this using the child theme functions file and/or Quick CSS.
Thanks in advance for your help!
Hey!
Try adding this at the very end of your theme / child theme functions.php file:
add_filter('avf_title_args', 'change_title_for_tag', 10, 1);
function change_title_for_tag($args) {
if(is_tag()) $args['title'] = get_queried_object()->name;
return $args;
}
Cheers!
Josue
Hey Josue,
Thanks so much for the info, but it doesn’t seem to have changed the title displaying.
Any idea what might be incorrect or missing?
Hi,
Can you please create us a WordPress administrator account? post it here as a private reply.
Regards,
Josue
Sure, see below, and thanks!
Hi,
Login provided doesn’t seem to work, please re-check.
Best regards,
Josue
Hi,
Best regards,
Josue
Please try again :)
Hi,
Please replace the code with this:
add_filter('avf_tag_label_names', 'avf_tag_label_names_mod', 10, 2);
function avf_tag_label_names_mod($label)
{
$label = single_tag_title('Posts by ', false);
return $label;
}
Best regards,
Ismael
Hey Ismael,
This gets it most of the way there, but “posts by” appears twice, so it says Posts by Posts by Randy. How to eliminate that duplication?
Also, the font size on this is ginormous, how do I make it smaller?
Thanks so much!
Hi,
check it now.
Best regards,
Josue
Hi Josue,
Problem fixed. :)
Last thing– Is there an easy way to make the size of that header smaller? It looks huge compared to the rest of the site.
Thanks!
Hi,
Please try adding this code to the Quick CSS section under Enfold > General Styling or to your child themes style.css file:
#top .fullsize .template-blog .tag-page-post-type-title {
font-size: 20px;
}
Best regards,
Yigit
Hi Yigit,
Perfect!!!
Thanks so much!