• Resolved pulsedog

    (@pulsedog)


    On my wordpress page, here is what I have under <title> in my header.php:

    <title>
    <?php if (is_home ()) { ?>
    <?php bloginfo('name'); ?>
     -
    <?php bloginfo('description'); ?>
    <?php } else { ?>
    <?php wp_title($sep = ''); ?>
     -
    <?php bloginfo('name'); ?>
    <?php } ?>
    </title>

    I have my Front Page set as “Home” and my Blog Page set as “Blog”.

    Problem 1.) The “Home” page appears to be set like any of the other pages, but “Home” doesn’t display, where as “Contact” does. That’s why the homepage looks like it has a – hyphen before it. I want to remove the hyphen from this page.

    Problem 2.) I really would just like a consistent way to title pages, so they’re all similar. I’d like to have the page name, blog name and tagline on every page (except “home”, like explained in problem 1).

    Is this possible?

Viewing 4 replies - 1 through 4 (of 4 total)
  • At present your home page is displaying the name of your blog (which is changed under Settings > General) and then the description (also known as the tagline).

    To get what you want try this:

    <title>
    <?php if (is_home ()) { ?>
    Home -
    <?php bloginfo('name'); ?>
     -
    <?php bloginfo('description'); ?>
    <?php } else { ?>
    <?php wp_title($sep = ''); ?>
     -
    <?php bloginfo('name'); ?>
    -
    <?php bloginfo('description'); ?>
    <?php } ?>
    </title>

    That should work.

    Thread Starter pulsedog

    (@pulsedog)

    Thank you very much for your help!

    Okay, so this is what I have now:

    <title>
    <?php if (is_home ()) { ?>
    Blog -
    <?php bloginfo('name'); ?>
     -
    <?php bloginfo('description'); ?>
    <?php } else { ?>
    <?php wp_title($sep = ''); ?>
     -
    <?php bloginfo('name'); ?>
     -
    <?php bloginfo('description'); ?>
    <?php } ?>
    </title>

    I had to change “Home” to “Blog”, since I have the Front Page set as home and Posts page set as Blog.

    Now my only thing is that the Front Page still shows a – in front of it. I think it’s doing that because it looks at my front page as a normal page like “Portfolio” or “Contact” and doesn’t have a title for it. Is there a way to segment this page within the code above (like what’s done for home page)?

    https://www.pulsedog.com if you need to see it live…

    Thread Starter pulsedog

    (@pulsedog)

    Don’t know why I can’t make this work, LOL.

    All I have to do is figure out a way to make my “Front Page” aka page-home.php another “else” exception that I can manually put the title together for it.

    I think my problem is that it things the Home page is the blog page, so that’s what’s confusing everything, making the code above work perfectly, except for the actual Home page!

    Any ideas?

    Thread Starter pulsedog

    (@pulsedog)

    Figured it out! For anyone else who’s a curious n00b, here’s how it’s done:

    <?php } elseif (is_front_page ()) { ?>

    This page has been a huge help: https://codex.www.ads-software.com/Conditional_Tags

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hypen in front of Homepage Title’ is closed to new replies.