Reputation: 929
I'm using the Custom Field Plugin to add a custom Field and call it to the content using the_field();
in my single.php
I just want to display this field on the all the categories except the "Articles which is 13", so I was trying somethin' like this:
<?php if !is_category( '13' ); { ?>
<h3 class="single-product__price"><?php the_field('precio'); ?></h3>
<?php } ?>
But it is not working. I'm wondering how to do this.
Upvotes: 0
Views: 41
Reputation: 3491
You should use in_category
, and put the conditional statement in parentheses.
<?php if (!in_category( $cat )) { ?>
<h3 class="single-product__price"><?php the_field('precio'); ?></h3>
<?php } ?>
Make sure $cat
is either ID (integer), name or slug (string) of the category.
Edit: I'm assuming you actually want to display the input on posts that are not in a particular category, hence in_category
. If you do indeed want to display it on all other Category archive pages, then is_category
would be correct.
Upvotes: 1