0

I need some help with the code to put inside the <title> to generate the following:

  • Static front page: Should just be the bloginfo('name')
  • All other pages: Should be wp_title() | bloginfo('name')

EDIT I have tried the following but it doesn't work:

<title><?php if(is_front_page() ) { bloginfo('name') } else { wp_title() | bloginfo('name') } ?></title>
1
  • What file contains this code? Is anything working? Oct 27 '14 at 18:46
1

The conditional tag is_front_page() is used to specifically check for a static front page, so you should be able to use that to switch between your title formats

<title>
    <?php if(is_front_page()) {
        bloginfo('name');
    } else { 
        wp_title( '|', true, 'right' );
    }; ?>
</title>
0

i think you forgot the ";"

should be:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.