How to use excerpt field for shares in Revive Old Posts

NOTE: 


This feature is now built-in to Revive Old Posts v9.0.0 + and can be accessed by selecting the "Post Excerpt" option from the share content setting on the "Post Format" tab of Revive Old Posts:


We're keeping the below text for users who might have not updated to v9.0.0


This method works for posts and any post type which supports post excerpts. To see the changes be sure you have either Post Content or Post Title & Content selected from the Share Content drop-down menu in the Post Format Settings of Revive Old Posts for the account.

Quick & Easy:

We've packaged the below code into a plugin which can be installed on your website. Click the link below to download it

Download: Revive Old Posts - Share Excerpts Plugin


DIY

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_share_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_share_content', 10, 2 );

That's it! 

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