• Resolved Matt

    (@emkadia)


    This has probably been asked a number of times before but I’m struggling to find a nice clean way to display the Page Title, followed by the Site Name, followed by the Site Description on all pages except the homepage, where I’d like it to just say Site Name and Tagline, to clarify…

    Homepage
    <title>Site Name | Site Tagline</title>

    All other pages
    <title>Page Name | Site Name | Site Tagline</title>

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • KB

    (@kespinoza)

    Add the code below to your header file between the head tags.

    <title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' |'; } ?> <?php bloginfo('name'); ?> | <?php bloginfo( 'description' ); ?></title>

    Thread Starter Matt

    (@emkadia)

    Hi Kespinoza, thanks for that but with that code I get the following

    Homepage
    SiteNameSiteDescription | SiteName | Site Description
    (no spaces between the first site name and description)

    All other pages
    PageTitleSiteName | Site Name | Site Description
    (no spaces once again between page title and first site name)

    Surely the statement needs an if(is_front_page() clause in there?

    Thanks

    Thread Starter Matt

    (@emkadia)

    SOLVED, after a few tweaks and an if statement, the following code does exactly what I need…

    <title>
    <?php
    if (is_front_page())
    {?>
    <?php wp_title( ‘|’, true, ‘right’ ); ?>
    <?php } else { ?>
    <?php wp_title( ‘|’, true, ‘right’ ); ?> | <?php bloginfo(‘description’); ?>
    <?php } ?>
    </title>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display Page Title, Site Name and, Site Tagline unless homepage’ is closed to new replies.