Prevent custom-taxonomy items from being listed in loop
-
Hi everyone,
I’m working on an online shop (using TheCartPress plugin) and i’m trying to customize the loops.
The plugin creates a custom taxonomy called tcp_product_category and inside that I have 3 groups, lets say cloths,shoes,reserved.
Items that belongs to ‘Reserved’ should be visible only to registered users and shouldn’t appear in the loop if the user is not logged.Currently i’m using this code in loop:
<?php if ( is_tax('tcp_product_category', 'reserved') && (!is_user_logged_in())) { echo 'hide product'; } else { echo 'do the normal loop'; ?>
but its not working…I also tryed the $get_taxonomies() function:
<?php $arg = array( 'name' => 'reserved' ); $output = 'names'; $categ = $get_taxonomies($arg,$output); if ($categ->name == 'reserved') && (!is_user_logged_in())) { echo 'hide product'; } else { echo 'do the normal loop'; ?> ?>
but no luck in here too.. What i’m doing wrong ? Wich is the best way to do that ?
Cheers
Massimiliano
- The topic ‘Prevent custom-taxonomy items from being listed in loop’ is closed to new replies.