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, 2014 at 18:46

2 Answers 2

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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