Open Graph
[resolved] Using the page excerpt for the description tag (1 post)

  1. Area256
    Posted 5 years ago #

    I like to have the excerpt used in the og:description tag if viewing a single post. So I made the following changes to the function opengraph_default_description:

    function opengraph_default_description( $description ) {
        if ( !empty($description) ) {
            return $description;
        // Use the blog description if we are not looking at
        // a single page, or no excerpt exists.
        $description = get_bloginfo('description');
        global $post;
        if ( is_singular() && !empty($post->post_excerpt) ) {
            $description = $post->post_excerpt;
        return $description;

    I personally think this should be made the default in the plugin source.


Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic