How to use excerpt field for shares in Revive Old Posts

This method works for posts and any post type which supports post excerpts.

Start off by including the following code in either your child theme's functions.php file or create a site-specific plugin using the following plugin:  https://wordpress.org/plugins/pluginception/

All you need to add is the plugin name and then copy the code below and enter it into the editing area, after pasting the code save your changes and head over to your Plugins area and activate the plugin to see the changes.

function rop_change_content( $content, $post_id ){

$excerpt = get_post_field( 'post_excerpt', $post_id );

//if the excerpt is empty let's fallback to the post content
if ( !empty( $excerpt ) ){
  $content = 'post_excerpt';
}else{
  $content = 'post_content';
}
return $content;
}
add_filter('rop_content', 'rop_change_content', 10, 2 );

To see the changes be sure you have either Post Content or Post Title & Content selected from the drop-down menu in the Post Format Settings of Revive Old Posts.

That's it! 

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.