Support » Plugin: Open Graph » [Plugin: Open Graph] Suggested Upgrade

  • Resolved bhoogterp

    (@bhoogterp)


    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/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Open Graph] Suggested Upgrade’ is closed to new replies.