[Plugin: Open Graph] Suggested Upgrade
-
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;
}
- The topic ‘[Plugin: Open Graph] Suggested Upgrade’ is closed to new replies.