Support » Fixing WordPress » How can I make the homepage title different from the navigation

  • Resolved miskettie

    (@miskettie)


    Hi

    I have been looking through the forums for an answer to this…there are lots of answers but I haven’t managed to get any of them to work. I am a coding novice.

    My theme is edegree and it does not support menus…so I am unable to do it that way. On my site (www.equinesites.co.uk) the nav menu comes up with the any new pages I create. So the ‘Home’ page has the title ‘Home’.

    I want to have ‘Home’ in the navigation and ‘Welcome to my site’ or some such as the page heading.

    Anyone know how I can do this? You’ll have to explain simply 😀

    I found this piece of code in the page.php

    <h2 class="catheader"><?php the_title();?></h2>
    <?php edit_post_link(' Edit', '<span class="editpost">', '</span>'); ?>
Viewing 13 replies - 1 through 13 (of 13 total)
  • Code for the Home Page is usually in index.php or home.php

    in your functions.php add this:

    function my_set_title($title) {
      if (is_home()) $mytitle = "Welcome To My Site";
      if (in_the_loop()) return $mytitle; else return $title;
    }
    add_filter('the_title' => 'my_set_title');

    Hi thank you both.

    Luck dragon – I put that in, but it didn’t like it very much and came up with an error, something about a T_double_arrow. Is there a certain place within functions.php that it needs to go?

    Nasir – my index.php is about five lines long and doesn’t refer to titles at all. The home.php similarly doesn’t seem to have much in….this is my home.php.

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    Really appreciate your help. Thanks

    my fault, this line add_filter('the_title' => 'my_set_title'); should actually be:
    add_filter('the_title', 'my_set_title');

    Ooo I am afraid it didn’t like that either….

    “Warning: Cannot modify header information – headers already sent by (output started at /home/equinesi/public_html/wp-content/themes/edegree/functions.php:8) in /home/equinesi/public_html/wp-admin/theme-editor.php on line 103”

    Is it something I am doing?

    did you put that code between the <? and ?>

    Sorry I am very much a novice at this.

    I put the <? ?> either side so that the whole thing looked like this:

    <? function my_set_title($title) {
      if (is_home()) $mytitle = "Welcome To My Site";
      if (in_the_loop()) return $mytitle; else return $title;
    }
    add_filter('the_title', 'my_set_title'); ?>

    I placed this at the bottom on my functions.php (is it supposed to be somewhere specific?)

    and it came up with “Parse error: syntax error, unexpected ‘<‘”

    Would it be easier if I pasted my functions.php here?

    Thank you for much for your help luckdragon.

    not here, it’s too large, paste it to: wordpress.pastebin.com

    and then paste the url it gives you here.

    Thank you so much luckdragon!!! It works, just had to change to is_front_page and voila it’s there.

    Thanks for your patience 😀

    🙂 glad I could help 🙂

    Now resolved 🙂

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘How can I make the homepage title different from the navigation’ is closed to new replies.