Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. if( ! function_exists( 'videotube_filter_post_view' ) ){
  2.     /**
  3.      * Filter default post view
  4.      * @method videotube_filter_post_view
  5.      */
  6.     function videotube_filter_post_view( $count, $post_id ){
  7.         $view = get_post_meta( $post_id, '_post_views', true );
  8.         if( is_array( $view ) && isset( $view['total'] ) && (int)$view['total'] > 0 ){
  9.             $count = (int)$view['total'];
  10.         }
  11.         return $count;
  12.     }
  13.     add_filter( 'mars_get_count_viewed', 'videotube_filter_post_view', 10, 2 );
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement