Advertisement
arie_cristianD

add tags filter in category arcive

May 14th, 2024 (edited)
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. add_filter( 'jnews_get_content_attr', 'custom_filter_tags', 10, 3 );
  2.  
  3.  
  4. function custom_filter_tags( $attr, $page, $term_id ) {
  5.     if ( 'jnews_category_' === $page ) {
  6.         if('_17'){ /* this filter will apply in category page with cat id 17 , you can change the _17 value */
  7.             $attr['exclude_tag'] = '16,17'; /* change with tags id that you want to exclude */
  8.  
  9.         }elseif('_18'){ /* this filter will apply in category page with cat id 18 , you can change the _18 value */
  10.             $attr['exclude_tag'] = '16,17';  /* change with tags id that you want to exclude */
  11.         }else { /* this will aplly to global category page template */
  12.             $attr['exclude_tag'] = '16,17';
  13.         }
  14.  
  15.     }
  16.     return $attr;
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement