I’m pretty sure you shouldn’t use negation in your conditions… If you check ! is_tax...
it will be true not only for other taxonomy pages, but also for singular pages, and any other…
So it should look like this:
<?php if ( is_tax('taxonomy-name','taxonomy-one' ) ) {?>
<div class="test" style="color: red"><?php the_field('field_name'); ?></div>
<?php } elseif ( is_tax('taxonomy-name','taxonomy-two' ) ) {?>
<div class="test" style="color: green"><?php the_field('field_name'); ?></div>
<?php } ?>
And about lack of documentation… I have no idea where have you looked for, but there is codex page for is_tax
: http://codex.wordpress.org/Function_Reference/is_tax 😉
PS. If you want to check if given post is assigned to term, then you should use has_term
function.
Related Posts:
- Trying to use Ternary operators with WP Conditionals
- Display Post co-authored in Author Page
- Rename “Portfolio” slug?
- Create a hierarchical taxonomy list in WordPress
- How to get post’s current parent term ID?
- Copy taxonomy terms from one post to another programmatically
- Add class to DIV depending on page loaded
- How to filter custom taxonomy term name, slug, and description?
- Hierarchical taxonomy list with modificated term links
- Show the section only if custom taxonomy was chosen
- Exclude product attributes from taxonomy terms loop
- How to insert wp_users ->user login name to wp_terms when a new user registering?
- Multidimensional Array
- Hi need update in my terms for other taxonomy
- How to change the author box selection on a post to a custom taxonomy
- WordPress: Export/Import Yoast meta title & description to custom taxonomy
- Show related products by attribute based and certain conditions
- Display acf taxonomy attachment
- How to hide a child category and show his parent category
- ACF Taxonomy field values not select in backend
- How to add Text before my Custom Term and hide it when empty
- ACF – Can’t get custom post type by taxonomy
- WordPress search query, how to modify the sql
- Custom Taxonomy as Link
- If Month=Particular month display content [closed]
- Query specific posts per user selections from dropdown menus
- Three different queries on same page
- Customising the search function?
- Conditional display for custom fields/taxonomy
- Add meta noindex to post if it has a specific taxonomy
- Why my filterable portfolio page work not perfectly between slug button and slug output WORDRPESS?
- Loop through categories and display posts title under each dropdown
- Grab posts by multiple categories
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- How to get original custom taxonomy slug after the slug has been rewritten?
- Displaying custom taxonomy on WooCommerce product page
- WordPress, AJAX and pre_get_posts using conditional tags
- Displaying Hierarchical custom taxonomy
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Get term siblings of current child taxonomy
- Adding Taxonomy Image to taxonomy loop [closed]
- multiple taxonomy select display only one in front end
- Display parent and child taxonomies in separate drop down select fields
- How to show only subcategories in parent category not parent category?
- need help with existing code showing subpages
- register_taxonomy() take much queries
- Custom field values to taxonomy terms
- Different Category system needed for the Custom Post Type
- Is_front_page inside header.php is always returning true
- If tag equals then show else show
- Way to bulk make all my tags lowercase?
- Pull Tags But Not as Links
- Advanced Custom Fields – display label and value only if value entered
- PHP conditional script issue
- Category title output before opening title tag
- How to check if the current page is at a specified path in the URL?
- List taxonomy term slugs within shortcode (do_shortcode)
- Conditional statement for dates
- How can I display a div ONLY if it is not a certain term page
- Hide image if taxonomy term is empty
- Don’t show certain div on front page?
- If ‘editor’ is empty, then
- Isotope Drop Down Categories Filter Function
- working with term_relationships table
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- Ajax filter button display all posts
- Add class to website based on post taxonomy
- Echo text using is_tag
- Use get() method to grab all categories and output inside another method
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Undefined index for default custom theme option
- Remove conditional tag from header
- Query custom post types & Taxonomies and list them in a table on a page
- Change header on pages displaying taxonomy items
- Listing titles and custom fields of entries within subcategories
- fetch woocommerce product with custom taxonomy
- Display an image based on field value
- WordPress site with embedded menu – gives You don’t have permission to access /wp-content/themes/xxx/taxonomy-redirect.php on this server
- Conditional featured image with youtube thumbnail
- Create a a form for custom taxonomy terms
- Storing content into a custom taxonomy
- How to make a conditional statement within $output in shortcodes.php?
- Creating a Category Taxonomy
- Check in which custom taxonomy belongs and change the style
- Taxonomy term count
- “if parent category is” conditional?
- How to get all the items of a taxonomy even if it does not have a custom post type?
- Using page title as a link to term archive
- Conditional for Post Format
- WordPress custom taxonomy
- Filter unique custom field value based on custom taxonomy category or other custom field
- conditional: if is page, and all subpages
- If custom taxonomy else conditional [closed]
- Conditionally remove comments and post meta in functions.php
- making php value numeric
- How to break up php code to avoid echo
- Woocommerce getting top level category parent and make all sub categories have the same template and menu
- exclude custom post type from running a function
- Taxonomy term description with style, only if the description exists?
- page 1 is not paged