Codeless
  • Support Home
  • Themes
  • Support
  • WordPress Tutorials
    • How to Start a Blog
    • Best Website Builders
    • Best Small Business Hosting
    • Email Marketing Services
    • Cheap WordPress Hosting
  • Video Tutorials

Community Forums

Change page header content for Posts pages?

posts
    • 8 years, 11 months ago CaryMillsap
      Participant

      Expired

      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?

    • 8 years, 11 months ago Kris
      Participant

      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!

    • 8 years, 11 months ago CaryMillsap
      Participant

      Expired

      This reply has been marked as private.
    • 8 years, 11 months ago Ruco
      Keymaster

      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!

      • This reply was modified 8 years, 11 months ago by Ruco.
      • This reply was modified 8 years, 11 months ago by Ruco.
    • 8 years, 11 months ago CaryMillsap
      Participant

      Expired

      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.

    • 8 years, 11 months ago CaryMillsap
      Participant

      Expired

      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!

    • 8 years, 11 months ago Kris
      Participant

      Hello,
      Glad to know you resolved this. Thank you for letting us know.
      Best regards!

    • 8 years, 4 months ago CaryMillsap
      Participant

      Expired

      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?

    • 8 years, 4 months ago CaryMillsap
      Participant

      Expired

      This reply has been marked as private.
    • 8 years, 4 months ago CaryMillsap
      Participant

      Expired

      I had failed to activate the tower-child theme from my WP Appearance > Themes panel. Problem solved.

    • 8 years, 4 months ago Mirela
      Participant

      Hello,

      That’s good to know. Thanks for sharing!

      Best regards!

Viewing 10 reply threads

You must be logged in to reply to this topic.

Login

Log In
Register

Renew Support

  • Renew Specular Support
  • Renew Tower Support
  • Renew Folie Support
  • Renew Handel Support
  • Renew June Support
  • Renew Picante Support
  • Renew Thype Support
  • Renew Regn Support

Search Forums

Forums

  • Bygge – Construction Theme
  • Converta – Software Theme
  • Folie – The WordPress Website Builder
  • Handel – Responsive Multi-Purpose Business Theme
  • June WooCommerce WordPress Theme
  • Livecast – Podcast Theme
  • Picante – Restaurant & Food WordPress Theme
  • Regn | Agency & Business WordPress Theme
  • Remake – Minimal Portfolio & Agency Theme
  • Specular – Multi-Purpose WordPress Theme
  • Suggest us Features
  • Tower – Business-Driven Multipurpose WP Theme
  • Vibrance – Photography Theme

Site Links

  • Support Policy
  • Specular Support Forum
  • Video Tutorials
  • Knowledge Base
  • Guides and Reviews

Useful Articles

  • Build a Website
  • Web Design & Development
  • Hosting
  • WordPress

Login

Log In
Register Lost Password