1

I would like to use this script (found here), but it generates a blank page when I add it to my header.php

     if ( is_home() ) { ?>
    <meta name="description" content="Your home page meta description" />
<?php } else {  ?>  <meta name="description" content="Your none homepage meta description" /> 
<?php } ?> 

Thank's!

3
  • 1
    Please add debug information to your question to make answers possible.
    – fuxia
    Commented Mar 25, 2013 at 15:37
  • You are using an opening PHP tag, right? That is <?php if ( is_home() ) etc
    – vancoder
    Commented Mar 25, 2013 at 17:14
  • Ok, yes indeed I forgot <? php! But I thought this script was the description that on the home page, off it appears on all pages. How can make for the description is displayed right on the home page? Thank's
    – gwen
    Commented Mar 26, 2013 at 7:44

1 Answer 1

1

I just tried it with this code and it all worked as it should:

<?php if ( is_home() ) : ?>
    <meta name="description" content="Your home page meta description" />
<?php else : ?>
    <meta name="description" content="Your non-homepage meta description" />
<?php endif; ?>

You want to be sure there's not a space between <? and php (<?php).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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