• Hello
    I am trying to add Opengraph meta data in head of the blog to use Facebook like button.

    So that each post can carry its own title, description, image.

    Everything is working fine but just not been able to catch meta description which is generated / added for All in One SEO plugin.

    Which function should I call from this plugin to echo correct description for each post?

Viewing 6 replies - 1 through 6 (of 6 total)
  • yup, I’d like to know also. I’ve tried adding a description tag directly to the header with such php as this:

    <?php if ( is_single() ) echo '<meta property="og:description" content="' ;?>
    <?php if ( is_single() ) the_excerpt() ;?>
    <?php if ( is_single() ) echo '" />' ;?>

    but I think my syntax is incorrect. Anyone want to suggest a fix to my code?

    I also tried combining this into a single statement:
    <?php if ( is_single() ) echo '<meta property="og:description" content="' ; echo ( the_excerpt() ) ; echo '" />' ; ?>

    doesn’t work. the_excerpt seems to add lots more stuff than just the excerpt.

    this all is more complex than I thought. This code (from 2008?) worked!

    WordPress: Dynamic Meta Description and Keywords howto

    Quoted here:

    <meta name="description" content="
    <?php if (have_posts() && is_single() OR is_page()):while(have_posts()):the_post();
    $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", get_the_excerpt());
    echo apply_filters('the_excerpt_rss', $out_excerpt);
    endwhile;
    elseif(is_category() OR is_tag()):
    if(is_category()):
    echo "Posts related to Category:
    ".ucfirst(single_cat_title("", FALSE));
    elseif(is_tag()):
    echo "Posts related to Tag:
    ".ucfirst(single_tag_title("", FALSE));
    endif;
    else: ?>
    ADD HERE YOUR DEFAULT DESCRIPTION
    <?php endif; ?>" />

    The above works, but if someone knows of a way to get the excerpt into the meta tag WITHOUT creating an additional loop, that would be nice. Anyone out there?

    I am also having this problem. I was hoping that this plugin would pull in the excerpt for og:description, but no luck. Anybody have a suggestions besides the extra loop?

    Same issue here. Found this and it works:

    <meta property="og:description" content="<?php echo get_post_meta($post->ID, '_aioseop_description', true); ?>" />

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘All in One SEO and Opengraph Meta for Facebook like button’ is closed to new replies.