WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Post meta description is not shown on facebook when sharing link

[Resolved] Post meta description is not shown on facebook when sharing link

  • Hi,
    My site’s address is http://svolze.com
    When I try to share my posts on my facebook profile it shows no excerpt/description. While on search engine, google+ and other sites display it correctly. In my header I found that my theme does not contain meta description tag. Should I put it? Though I am using yoast SEO plugin the problem persists. I have tried putting the following codes still it can’t help me

    <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <meta name="description" content="<?php the_excerpt_rss(); ?>" />
    <?php endwhile; endif; elseif(is_home()) : ?>
    <meta name="description" content="<?php bloginfo('description'); ?>" />
    <?php endif; ?>
    <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <meta name="description" content="<?php the_content_limit(200)?>" />
    <?php endwhile; endif; elseif(is_home()) : ?>
    <meta name="description" content="<?php bloginfo('description'); ?>" />
    <?php endif; ?>
    <meta name="description" content="<?php
     // if home page output blog name and description
     if (is_home()) { bloginfo('name'); echo " - "; bloginfo('description');}
     // if single page output either excerpt if available or post title
     elseif (is_single()) {
     $custommeta = get_post_meta($post->ID, "MetaDescription", true);
     // checks ot see if the custom field MetaDescription is not empty
     if ($custommeta !=='') {echo $custommeta;}
     // check if excerpt exists for the post and output it if it does
     elseif (!empty($post->post_excerpt)) {the_excerpt();}
     // if there's no custom field or excerpt output the post title
     else {single_post_title('', true);}
     }
     // if category page output the category description
     elseif (is_category()) {echo category_description();}
    
     // if it's any other page display this generic description
     else { echo 'Add your own generic site description here';}
     ?>"
    />

    Please help me with this problem.

Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Resolved] Post meta description is not shown on facebook when sharing link’ is closed to new replies.