Advertisement
phpface

Untitled

Sep 23rd, 2020
1,878
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1.  
  2. /**
  3.  *
  4.  * Filter the post args
  5.  *
  6.  * @param  array $args
  7.  * @return array $args
  8.  */
  9. function videotube_child_filter_scroll_post_args( $args ){
  10.  
  11.     global $post;
  12.  
  13.     if( term_exists( $post->post_name, 'categories' ) ){
  14.         $args = array_merge( $args, array(
  15.             'tax_query' =>  array(
  16.                 array(
  17.                     'taxonomy'  =>  'categories',
  18.                     'field'     =>  'slug',
  19.                     'terms'     =>  $post->post_name
  20.                 )
  21.             )
  22.         ) );
  23.     }
  24.  
  25.     return $args;
  26.  
  27. }
  28. add_filter( 'mars_scrolling_post_args', 'videotube_child_filter_scroll_post_args', 10, 1 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement