Advertisement
phpface

Untitled

Dec 24th, 2015
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. if( !function_exists( 'marstheme_query_posts_from_last_7_days' ) ){
  2.     /**
  3.      * @param unknown_type $args
  4.      * @param unknown_type $block_id
  5.      * @return multitype:multitype:string
  6.      */
  7.     function marstheme_query_posts_from_last_7_days( $args, $block_id = null ) {
  8.         if( $block_id == 'your unique block ID' ){
  9.             if( isset( $args['date_query'][0]['year'] ) && isset( $args['date_query'][0]['week'] ) ){
  10.                 unset( $args['date_query'][0]['year'] );
  11.                 unset( $args['date_query'][0]['week'] );
  12.                 $args['date_query'] = array(
  13.                     array(
  14.                         'column' => 'post_date_gmt',
  15.                         'after' => '1 week ago',
  16.                     )
  17.                 );
  18.             }
  19.         }
  20.         return $args;
  21.     }
  22.     add_filter( 'mars_sc_videotube_args' , 'marstheme_query_posts_from_last_7_days', 20, 2);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement