WordPress.org

Ready to get started?Download WordPress

Forums

Meta Tag Description problem (2 posts)

  1. etchel1
    Member
    Posted 2 years ago #

    I'm having a problem on Single Post, can you guys help me what to put on the meta description? I need to put an excerpt, am I doing it right?
    I wanted the excerpt to appear on google search engine. how can I do that manually? I already fixed my SEO so it will crawl it. I wonder if my meta description is my prob coz whenever I search my own post on google, it gives me the description of my index page, not the single post's description

    <?php if ( is_single() )  { ?>
    		<meta name="description" content="<?php the_excerpt(); ?>">
    
    	<?php }
    	else
    		//do nothing
    	?>

    don't mind my if else statement, am asking about the meta tag description.

  2. dkotter
    Member
    Posted 2 years ago #

    This is a code snippet I've used before that works good:

    <?php
    if (is_singular()):
    global $post;
    setup_postdata($post);
    ?>
    <meta name=”description” content=”<?php the_excerpt_rss(); ?>” />
    <?php endif; ?>

    But I'd recommend using an SEO plugin to handle things like this, since they'll do a better job and do a lot more then just add meta descriptions. My favorite is WordPress SEO by Yoast.

Topic Closed

This topic has been closed to new replies.

About this Topic