WordPress.org

Support

Support » How-To and Troubleshooting » How do I make Page title different from in nav?

How do I make Page title different from in nav?

  • This is probably REALLY easy — but I’ve missed it!

    The Theme I’m using has the navigation along the top, in tabs. I want a static Home Page with a tab to it that says ‘Home’ — but I don’t want the heading on the Page itself to be ‘Home’. And that’s what’s happening.

    When I did the Write Page thing to create the static Home Page, I had to fill in the ‘Title’ box with ‘Home’ to get the tab in the nav bar. But that put ‘Home’ on the Page itself. Which I don’t want. I want the Page heading to be different. Or nothing at all.

    So… how do I create a page with a short, sharp tab name, but with a completely different Page heading once you get to view the page?

Viewing 15 replies - 1 through 15 (of 20 total)
  • Basically, you’ll have to cheat.

    The best way is to remove any references to <h1></h1> in your page.php template file, then actually put your page heading into the page-post itself surrounded by those same H1 tags.

    That way, the page title as far as wordpress goes is entirely separate from your page content.

    Thanks for such a speedy reply — I’m glad my question made sense!

    I get the point about the H1 tags and I’ll give that a go right now.

    What will happen to the tab in the navigation? Suppose I’d better try it and see!!!

    Oh, dear. Not safe left on my own.

    I went and had a look at the page.php template (I’m using K2, BTW) and the only mention to headings is this about H2 tags — no H1 tags:

    <h2>” rel=”bookmark” title='<?php printf( __(‘Permanent Link to “%s”‘,’k2_domain’), wp_specialchars(strip_tags(the_title(”, ”, false)),1) ); ?>’><?php the_title(); ?></h2>

    Is this what I should delete?

    Maybe I should find a template that’s already sorted out 🙁

    k2 is kind of a complex template to start modding, but sure… it could be H1, H2 or <div class=”jellybean”> honestly…

    you’ve found the right one though – as it contains <?php the_title(); ?>

    I’m not sure why it’s a link, as when you’re viewing a page, you can’t really go any further… when you click that, where does it go?

    anyway, thats the line…. if you keep a copy of this page.php to one side, then you can’t really make any mistakes that can’t be easily undone by simply uploading page.php again.

    1) remove that line.
    2) put <h2>This is my new title</h2> in your actual page text
    3) see how you go 😉

    RosieMBanks
    Member

    @rosiembanks

    Hey, there, Milly, I went to your site and poked around… are you using 2.3 for your WordPress site? You should upgrade for security’s sake.

    I think you should be looking for those tags in header.php, not page.php. And on the only WordPress install I could find on your site was using a theme called Regulus. On that theme, you find this line in header.php:

    <li <?php if (((is_home()) && !(is_paged())) or (is_archive()) or (is_single()) or (is_paged()) or (is_search())) { echo "class=\"current_page_item\""; } ?> ><a href="<?php echo get_settings('home'); ?>" ><?php _e('Home','regulus'); ?></a></li>

    And replace ‘Home’ with whatever title you want to appear there. If you’ve got K2, this won’t work.

    Oops, I just saw Ivovic’s response. I may have misunderstood what you are trying to do.

    I think you’re misunderstanding, Rosie. (edit: and you just noticed while I typed this…. waste of keystrokes! cheers)

    1) Milly wants to change the main title displayed on the page-page, so that the page-title displayed when wp_list_pages is called can be shorter.

    my suggestion was to include a longer title as part of the page content, and remove the main heading from being displayed, which would prevent the shorter title used for navigation purposes from showing right above the content.

    example:

    your page-navigation is Home | About | Contact

    but you want something a little nicer to be displayed on the page itself… like “Welcome to MySite.com”, “About MySite.com” and “Contact the Author” respectively.

    2) if upgrading for security reasons, one should upgrade to wordpress 2.3.3. “upgrading” to 2.5 is like upgrading your dinner by opening a can of dog food.

    TrishaM
    Participant

    @trisham

    A static home page requires that you create a new Template file (the suggestion is to call it home.php or homepage.php, then under Options > Reading you set that template to be the static page used for your Home page.

    If you start with the page.php file to build your new template, you can remove the line that usually looks like this, which is what puts the normal page title on the page:

    <h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>

    And either leave nothing there or hard-code what you want to be there……this won’t effect your navigation – you’ll still see a ‘Home’ tab if the page is titled Home

    I hope I’m understanding what you want to do correctly…….

    TrishaM
    Participant

    @trisham

    Ooops I forgot to mention that you’ll need this code at the very top of the new template in order for WP to recognize it as a template file…..

    <?php
    /*
    Template Name: Home
    */
    ?>

    This should go above the call get_header()

    “A static home page requires …”

    Actually, no, it doesnt. I’m sure it used to at some point, but it really doesn’t anymore. Now you just select the wordpress page from a dropdown in the options.

    RosieMBanks
    Member

    @rosiembanks

    2) if upgrading for security reasons, one should upgrade to wordpress 2.3.3. “upgrading” to 2.5 is like upgrading your dinner by opening a can of dog food.

    Heh! I disagree on the upgrade part. I haven’t had any problems on any of my sites with 2.5 (not yet, anyway!)

    And as I reread Milly’s post, she says she wants the tab to read “Home” but not the title on the page itself. Is that right? If so, then maybe I did get it right?

    But I am the first to admit to being the World’s Biggest WordPress Goober, and am probably wrong! Heh.

    Rosie, yes, you understood what she wants… but perhaps not the best way to achieve that.

    If you edit the header, you have to hard-code your short page names which then only changes that in the header, which may be fine now, but then you might want to list your page names in the sidebar too, so if you do that, you’d have to hard code them there as well…

    that can be cumbersome when adding pages later on.

    what I’ve suggested is to simply name the pages by the short name in wordpress, and remove the part of page.php which displays the page title.

    by default a title-less page would be displayed, but all the navigation links would have your short page-names in them.

    To add a title to your pages then, all you’d have to do is insert a heading at the top of the page you’ve just written.

    Seems much more flexible to me, and involves a lot less fiddling with php and conditionals, etc… because it gives you back the use of functions like wp_list_pages.

    My goodness, you’ve all been busy whilst I’ve been sleeping!!

    Hey, there, Milly, I went to your site and poked around…

    Rosie — All I can say is ‘aghhhh’. I didn’t know anyone could get to that as there isn’t a clickable link from my main website to it, so I thought it was safe whilst I fiddle around! Yes, that’s Regulus, and I do want to do the same with that, at some point.

    I’ve got K2 on my computer where I can make embarrassing mistakes in private 😉

    k2 is kind of a complex template to start modding,

    Ivovic — Oh, dear. I chose K2 as I thought it was kind of straightforward. Shows you what I know! Thing is, if you learn everything first, you’d never get anything done, would you?

    But, bouyed up by your advice — and the fact that you’ve understood me perfectly! — I shall have a go with your instructions. So, fingers crossed!

    everything is relative of course… k2 has some niceties built in, which makes life simpler, but makes the theme more complex.

    I’m sure you’ll do fine though.

    Let us know how you go. Once you get your first theme modification under your belt, you’ll find it’s pretty addictive!

    TrishaM
    Participant

    @trisham

    @ivovic, I must respectfully disagree. Your method works, but isn’t the simplest solution to the original question.

    The way I read the original request, Milly has two needs:

    1. A static (read: not posts) page for the Home Page; and
    2. for the “Home” page to not have a the page title appear at the top of the homepage content. It doesn’t sound like she/he wants ALL pages to not have the page title to appear, just the home page. So if you remove that part of the page.php file, all pages will be missing the page title above the content, and he/she would have to manually add that back in for every page.

    The simplest solution to meet both needs is to
    1. simply make a new page template, based on the page.php but with a new name,
    2. remove that section referencing the title,
    3. Create a new page called “Home” using Write>Page.
    4. use your new template for the new ‘Home’ page, and finally
    5. Set the new page to be your Home page under Options>Reading

    This way you do NOT effect all other pages.

    Oh my goodness!! I did it! I did what Ivovic said — and it worked!!

    Good grief! I can see how you get addicted to all this modding, I must say. I’ve never fiddled with code like that before. Added the odd <p> and br tags, but that’s about it (not that they always worked).

    This IS amazing and now I want to learn loads more. I’ll just have to fit in work somewhere 🙂

    But so many thanks to you all.

    Think I’ll have a go at TrishaM’s suggestions, next. Could be here all night 😉

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘How do I make Page title different from in nav?’ is closed to new replies.