Advertisement
fauzanjeg

Get Post Revisions on Single Post Page

Feb 1st, 2021
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. /* Get Post Revisions on Single Post Page */
  2. function jnews_revisions() {
  3.     $post_id = get_the_ID();
  4.    
  5.     if( is_single($post_id) ) {
  6.         $revision = wp_get_post_revisions( $post_id );
  7.         $total = count($revision);
  8.        
  9.         $output =
  10.             "<div class='jeg_meta_like_container jeg_meta_like jeg_meta_revisions'>
  11.                 <a class='revisions' href='#' data-id='{$post_id}' data-type='revisions' data-message=''>
  12.                     <i class='fa fa-low-vision'></i> <span>{$total}</span>
  13.                 </a>
  14.             </div>";
  15.  
  16.         echo jnews_sanitize_output( $output );
  17.     }
  18. }
  19.  
  20. add_action( 'jnews_render_before_meta_right', 'jnews_revisions' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement