Archived topic
How to delete / modify category name displayed on category pages?
8 replies · Started by victor on May 8, 2020
Heya! I have premium if that helps at all!
If I click on a category page, say, Lunch. "Lunch" is displayed prominently at the top in its own div with all the blog posts in that category displayed below. How would I modify it to say something else but still be a Lunch category? And/or, how would I go about deleting it as well as deleting the surrounding div? I can delete the word "Lunch" from displaying but not the background (aka div). And if I can get it to say something else and still be under the Lunch category, that'd be even better!
Thanks!!
I was also wondering if there's an easy way to adjust line height of text for certain posts. For example, some of my posts are a bit ugly when I applied a global line height to all blog posts - is there a way to edit it for only certain categories or individual posts?
Hi there,
The category archive title is controlled by WordPress.
I believe this is what you are looking for:
https://developer.wordpress.org/reference/hooks/get_the_archive_title/
See examples of the usage:
https://generatepress.com/forums/search/get_the_archive_title/#post-1275841
Please open a new topic for the separate question once this one is resolved.
Thanks!
Thanks!
No problem :)
Oops, I thought I understood it.
This is a hook, right? I haven't created a hook before - but when I go to create one in elements, what is the hook referring to? before_archive_title or after_archive_title? But confused on how to implement this, say, on a category called Lunch where I want NewLunchCategory to be displayed instead.
That is a filter and cannot be added as a hook element.
Did you take a look at the link with a bunch of examples?
Yes, I looked at both the documentation which seemingly labels it as a hook(?), and I went through the other link you sent me.
It's not immediately clear to me how this function activates and where it goes. I'm still new to WordPress and my understanding was that if you want to modify js or php, it's advised you use a hook. Is that true?
I'll snoop around the function files and see what I can find for now. I'm assuming you need to call that function at startup? The syntax seems foreign to me as I've never worked with php. Idk, I'll look around.
Edit: Ahh, figured it out for now, goes in the functions.php file and works off of that...alrighty. Thanks again!!
No problem :)