Advertisement
Guest User

Untitled

a guest
May 20th, 2014
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.12 KB | None | 0 0
  1.             //With print_r and with exclude category
  2.             // auto posts by cat
  3.             if( $bawmrp_options['auto_posts'] == 'cat' || $bawmrp_options['auto_posts'] == 'both' ):
  4.                 $cat = get_the_category( $post->ID );
  5.                 $cat_ids = wp_list_pluck( $cat, 'term_id' );
  6.                 $key = array_search('68', $cat_ids);
  7.                 unset($cat_ids[$key]);
  8.                 $args['category'] = implode( ',', $cat_ids );
  9.                 print_r($args);
  10.             endif;
  11.            
  12.             Output: Array ( [post_type] => wpcproduct [post_status] => publish [post__not_in] => Array ( [0] => 3216 ) [numberposts] => 10 [post_count] => 10 [order] => RAND [category] => )
  13.            
  14.             //With print_r and without exclude category (Original code)
  15.             // auto posts by cat
  16.             if( $bawmrp_options['auto_posts'] == 'cat' || $bawmrp_options['auto_posts'] == 'both' ):
  17.                 $cat = get_the_category( $post->ID );
  18.                 $cat_ids = wp_list_pluck( $cat, 'term_id' );
  19.                 $args['category'] = implode( ',', $cat_ids );
  20.                 print_r($args);
  21.             endif;
  22.            
  23.             Output: Array ( [post_type] => wpcproduct [post_status] => publish [post__not_in] => Array ( [0] => 3216 ) [numberposts] => 10 [post_count] => 10 [order] => RAND [category] => )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement