-
-
On my site, the same page is used to render posts, categories, and tags. Is there any way to change the page header content (it defaults to the page title), so that it can reflect what I’m showing on a given page. For example, I’d like the page header to say “Posts” when viewing mysite.com/posts, but I’d like it to say “Books” when viewing mysite.com/cat/books. …Or “XYZ Releases” when viewing mysite.com/cat/xyz-releases.
How could I do that?
-
Hello,
Your site already shows that, it reflects what you are showing on a given page. Can you be more clear on your question? I don’t understand very well what you are trying to do.Best regards!
-
-
Hello,
Please edit the file ‘tower/includes/view/page_header.php’
After these lines:
if(is_404()) $title = __('404 Not Found', 'simple');
Add these ones:
if(is_category()) $title= get_cat_name($id);
Best regard!
-
Thank you!
However, I’m not quite there yet. Using this code, I get a blank title. Doing a little debugging, I used:
if(is_category()) $title = sprintf("id=%s '%s'", $id, get_cat_name($id));
What I found is that $id is always 880, and get_cat_name($id) = ”.
Are you certain that $id is the right argument for the get_cat_name() call?
Thank again.
-
Eureka: I have found that this code solves the problem:
if(is_category()) $title = single_cat_title("", false);
Thank you again for your help. It would have taken me a long to find this!
-
Hello,
Glad to know you resolved this. Thank you for letting us know.
Best regards! -
After upgrading to the newest Tower release today, the solution above no longer works. I can confirm that the if(is_category())… code is still in my wp-content/themes/tower-child/includes/view/page_header.php file.
What can I do to make this work again?
-
-
I had failed to activate the tower-child theme from my WP Appearance > Themes panel. Problem solved.
-
Hello,
That’s good to know. Thanks for sharing!
Best regards!
-
You must be logged in to reply to this topic.