How do I make Page title different from in nav? (21 posts)

  1. Millymax
    Posted 7 years ago #

    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?

  2. Ivovic
    Posted 7 years ago #

    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.

  3. Millymax
    Posted 7 years ago #

    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!!!

  4. Millymax
    Posted 7 years ago #

    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 :-(

  5. Ivovic
    Posted 7 years ago #

    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 ;)

  6. RosieMBanks
    Posted 7 years ago #

    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.

  7. Ivovic
    Posted 7 years ago #

    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.


    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.

  8. TrishaM
    Posted 7 years ago #

    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.......

  9. TrishaM
    Posted 7 years ago #

    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.....

    Template Name: Home

    This should go above the call get_header()

  10. Ivovic
    Posted 7 years ago #

    "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.

  11. RosieMBanks
    Posted 7 years ago #

    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.

  12. Ivovic
    Posted 7 years ago #

    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.

  13. Millymax
    Posted 7 years ago #

    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!

  14. Ivovic
    Posted 7 years ago #

    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!

  15. TrishaM
    Posted 7 years ago #

    @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.

  16. Millymax
    Posted 7 years ago #

    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 ;-)

  17. TrishaM
    Posted 7 years ago #

    If what Ivovic suggested worked for you then you may not need to make any more changes......you only need to if you decide that you DO want page headings to appear above your content on pages, to let the visitor know that they are on the right page....

  18. Millymax
    Posted 7 years ago #

    You have a good point there, Trisha, as from a usability point of view it's pants to have one thing on the navigation and something totally different on the page the visitor goes to.

    So a lot of the time it makes sense that the two are the same. Apart from Home of course. You really, really, really DON'T need your Home page to say 'HOME', big and bold.

    What I want to be able to do sometimes is have a tab that says, say, 'Services' and a heading on the Page that says 'Services: What we do and how we do it'. If you see what I mean. Something a bit more expansive.

    And, anyway, you've got me going now! I've got to see if I can so what you suggest, too. Here's hoping that if I flounder around out of my depth for long enough, I'll learn how to swim.

  19. Ivovic
    Posted 7 years ago #

    Yep, well it's easy to include the short label as part of the heading in the actual page-text.

    Something you might also want to investigate is 'breadcrumbs' - they basically give you nested navigation links above your content.

    There's a plugin that does this, but you can see something very similar in action on my site as well. (click a sub-category, and look at the top of the page)

    Check out the plugin here: Breadcrumb NavXT

    It may not really suit what you're doing, but it's worth a look.

  20. Millymax
    Posted 7 years ago #

    Love the breadcrumbs on your site, Ivovic, so went to the plugin site and found that it's for WP 2.5. Now, after all the iffy comments about 2.5, I still haven't dared upgraded. But perhaps it's time to bite the bullet?

  21. Ivovic
    Posted 7 years ago #

    well, I kind of wrote my own rather than using the plugin, but there are other versions of this plugin which aren't only for 2.5.

    I haven't upgraded to 2.5 yet either - and I don't think I'm going to until some of the issues are ironed out in forthcoming versions, so I certainly wouldn't suggest that this should be your reason to dive in.

    Try this until you upgrade. It's the same project, except it's now been taken over by someone else and renamed a little.

Topic Closed

This topic has been closed to new replies.

About this Topic