WordPress.org

Ready to get started?Download WordPress

Forums

Open Graph
[resolved] Suggested Upgrade (2 posts)

  1. bhoogterp
    Member
    Posted 2 years ago #

    For posting the main blog post, the code works great...

    For individual posts, an exceprt is preferred...

    Consider the following code for an upgrade, to post a 300 character excerpt using strip_tags() instead of the general blog description...

    /**
    * Default description property, using the bloginfo description.
    */
    function opengraph_default_description( $description ) {
    if ( is_single() && empty($description) ) {
    global $post;
    $x = strip_tags($post->post_content);
    $x = str_replace(array("\n", "\r", "\t"), array(" ", " ", " "), $x);
    $description = substr($x, 0, 300); //get_the_excerpt($post->ID);
    }

    if ( empty($description) ) $description = get_bloginfo('description');
    return $description;
    }

    http://wordpress.org/extend/plugins/opengraph/

  2. Will Norris
    Member
    Plugin Author

    Posted 2 years ago #

    I just released v1.3 which fixes this.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags