How Do I Change The 'Page Title' On Individual Pages?

Community Forums Forums Design Tips and Tricks How Do I Change The 'Page Title' On Individual Pages?

This topic is: not resolved

This topic contains 7 replies, has 2 voices, and was last updated by  richiemerritt 1 year, 9 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #5069

    richiemerritt
    Participant

    Hello!
    I was hoping someone could enlighten me with the code to change the Page Title (#page-title) on individual pages.
    I’m using the minimum child theme, and I have a blog page and a podcast page (blog category pages), I would like to change the Page Titles on the blog page and the podcast page from the default text:  “From The Blog”. the website is: http://tattooinsider.com

    Any information would be awesome. Thank you for your time guys :)

    ♥Richie Merritt

    #5078

    ramseyp
    Participant
    Post count: 99

    Hi Richie,

    Depending on what you want there, you would have to do some editing of the page-title.php file in the theme (minimum) directory. That file has several conditional statements there that output the #page-title div. What it places in there, depends on the conditional that’s triggered. You mentioned two category archives. page-title.php is set to display “From the Blog” on any category, tag, or date archive (along with single posts, search results, or author archives).

    Do you want it to not show on those pages or do you want it do something different?


    #5100

    richiemerritt
    Participant

    Thank you for your response, ramseyp, I really appreciate it :)

    Yes, in response to your question, I would like it to do something different.
    I have made edits to the page-title.php file before, but  tweaking the conditional statements for it to display for individual category archive pages makes me a bit nervous. I’ve been reluctant to experiment there, as I normally would.

    So, I would like for the ‘podcast’ page to display the page title: “From The Podcast” (or something of that nature).
    And for the ‘blog’ page to display: ‘From The Blog’.

    I’ve had a difficult time trying to find any detailed supporting information on this issue, so your help is very appreciated.

    Thanks again.

    Richie Merritt

     

    #5111

    ramseyp
    Participant
    Post count: 99

    Hi Richie,

    I’ve got some code in a Gist that should work. Look at that link and you can see where I’ve added an exclusion in the “From the Blog” conditionals for a single category name. Then after that, I add a conditional just for that one category to output a custom title text for it.


    #5113

    richiemerritt
    Participant

    Thank you ramseyp.
    I’m reviewing the code and will try to implement this.
    Questions…
    (Everything seems pretty straight-forward in your instructions, but…)

    • what is the ” && !is_category ”  ??? Am I supposed to replace the ampersands (&&) with something?

    And

    • will I need to replicate this code to create an new elseif statement for the ‘blog’ category page as well, or?

    Thank you :)

    #5114

    ramseyp
    Participant
    Post count: 99

    Hi Ritchie,

    What you’re seeing there is a combination of conditionals. The double ampersands have to be there so ‘my-category’ is excluded from the overall is_category() conditional preceding it. The !is_category(‘my-category’) is a negative conditional. So both sides of the double-ampersand mean “if it’s a category archive, but not the ‘my-category’ archive…” I would recommend reading through the Codex page on Conditional Tags so you can see how they’re used. It will help, should you have another instance where you need to use them.

    As for the blog, it looks like you have a “blog” category, so nothing special needs to be done. When that category is shown, “From the Blog” will be at the top of the page.


    #5119

    richiemerritt
    Participant

    Fantastic! Thank you so much for your time and help ramseyp!

    I will implement the code, and post a follow up with my results, etc., so others can use this information.

    Thanks again.

    Richie Merritt

    #5123

    richiemerritt
    Participant

    Perfection!
    Implementing the code with instructions you provided worked flawlessly!

    Thank you so much ramseyp!
    I owe you one.

    Richie Merritt
    richiemerritt.com
    tattooinsider.com

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.