Support » Fixing WordPress » Static front page – title will not show as intended

  • Resolved Marc Lucraft

    (@lucraft)


    I am working on this site. As you will notice the title says ‘- Briarcroft Care Home’ – however, with the code I am using it should show ‘Site description – Briarcroft Care Home’….

    I started this topic believing that the code was the issue, however I have trawled forums and read WordPress docs and all the coding appears to be right. It just doesn’t seem to recognise that ‘About Us’ is my home/front_page?!? Even using this…

    <title><?php bloginfo('name'); ?> | <?php is_home() ? bloginfo('description') : wp_title(''); ?></title>

    …straight from from WordPress doc s does not work!

    Where am I going wrong?

Viewing 6 replies - 1 through 6 (of 6 total)
  • LIMEXS

    (@limexs)

    Have you used is_front_page() ?

    Thanks for the reply limexs.

    Yeah I have tried that in place of is_home() without any luck. 🙁

    LIMEXS

    (@limexs)

    I’ve checked the site again, I think you’ve set custom home page url.

    I think testing for condition bloginfo(‘name’) == “” can be helpful.
    if condition is true we can output something echo ‘string’

    otherwise, we can test condition like this $post->post_title == “About Us”

    esmi

    (@esmi)

    Forum Moderator

    Try

    <title><?php bloginfo('name'); ?> | <?php if( is_home() || is_front_page() ) { bloginfo('description'); } : wp_title(''); ?></title>

    @limexs: thanks for the suggestion, although I was slightly confused at your post?
    Did you mean try “is_page(‘about-us’)” ?

    If so, I’m sure this would have worked, however it’s happened on a couple of sites I’m working on, so would rather not have to change the condition for each sites home page in the future.

    @esmi: I tried your suggestion which seems to be working, although I had to amend slightly to this…

    <title><?php bloginfo('name'); ?> | <?php is_home() || is_front_page() ? bloginfo('description') : wp_title(''); ?></title>

    … and to get back to my original title ‘layout’, my final code became this:

    <title><?php is_home() || is_front_page() ? bloginfo('description') : wp_title(''); ?> — <?php bloginfo('name');?></title>

    Thanks for your help – I knew it must be simple!

    esmi

    (@esmi)

    Forum Moderator

    Glad I could help 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Static front page – title will not show as intended’ is closed to new replies.