3

I have the theme Hatch and I can't figure out how to change the meta-description of the home-page. It is not an actual page, it is the default view for posts.

Have searched everywhere for an answer but really can't figure it out. I have downloaded the plug-in SEO by Yoast, but only seem to be able to change the meta-description on pages and posts...?

  • You can use the WordPress General Settings for name and tagline otherwise the plugin includes fields for the home page. – Brad Dalton Jan 7 '14 at 19:29
3

You do not need to add Yoast if you only want to add meta tags to the homepage. Just some minor editing will save you on performance.

You can use the is_home() function.

Insert this to your header.php:

<?php if (is_home()) { ?>
 <meta name="description" content="Your description for homepage..." />
<?php } else { ?>
 <meta name="description" content="Description for other pages..." /> 
<?php } ?>
  • 1
    very useful code – prosti Oct 6 '16 at 9:53
1

You can also do by this

 <?php
the_post();
if (  is_home()  ) { ?>
<meta name="description" content="YOUR DESCRIPTION" />
<?php } elseif (is_single()) { ?>
<meta name="description" content="<?php the_excerpt(); ?>" />
<?php } ?>

this will set different description for home and other.

1

I had the same issue, and since this post is one of the first results that comes up in Google, I wanted to share the solution that I found.

The code that Christine provides is good, but the problem is that you shouldn't generally edit the header.php file directly, since your changes would be erased when you update the theme.

The solution is to insert the code into your own plugin, and to use an action hook in order to insert the description into the header:

<?php    
function add_meta_home() { 
    if (is_home() || is_front_page()) { ?>
        <meta name="description" content="Lorem ipsum dolor sit amet."/>
        <?php
        }
    }
add_action('wp_head', 'add_meta_home');
?>

The use of (is_home() || is_front_page()) ensures that the meta description displays for your website's homepage, regardless of how it's configured.

-1

For WordPress SEO (by Yoast) - it's under titles and meta - there will be a home tab. The All in one SEO plugin gives the option to autogenerate or customize the description

I made an SEO video using Yoast: https://www.w3bdesign.ca/free-wordpress-seo/

  • In the latest Yoast there is no "Titles and meta" option, any other way? – Petar Vasilev Oct 24 '16 at 19:29
  • 1
    @PetarVasilev you need to enable Advanced Settings in Yoast. – Matt Sephton Dec 4 '17 at 15:06

protected by fuxia Jun 23 '15 at 6:31

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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