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
- How to Add Custom Fields to Custom Taxonomies in WordPress CLEANLY
- Creating custom Woocommerce attribute taxonomies from a plugin
- Show content if parent page has children
- WordPress custom taxonomy description for each post?
- Display certain amount of posts on taxonomy archive page
- Conditional statement for parent, child and grandchild pages
- Get used terms by an author as array of strings
- When is is_admin() available?
- PHP Customization: Taxonomies and Queries, why? [closed]
- Check if current page is wp-admin
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- How to add custom taxonomy slug in CPT permalink?
- Make first letter of my taxonomy uppercase
- Output 2 items within the Loop
- Sum custom field values of particular taxonomy
- Query all posts of a custom taxonomy term
- Taxonomy linked to pages
- Randomly Assign an Image’s Alt Text Based on Data From Post
- 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
- Get term siblings of current child taxonomy
- multiple taxonomy select display only one in front end
- How to show only subcategories in parent category not parent category?
- 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?
- PHP conditional script issue
- List taxonomy term slugs within shortcode (do_shortcode)
- 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)
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Remove conditional tag from header
- Conditional featured image with youtube thumbnail
- “if parent category is” conditional?
- How to get all the items of a taxonomy even if it does not have a custom post type?
- Conditional for Post Format
- WordPress custom taxonomy
- If custom taxonomy else conditional [closed]
- making php value numeric
- 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
- WordPress: Displaying all the post tags from within a specific taxonomy’s term
- how to insert content into my taxonomy
- update_term_meta() only updating once on certain meta keys
- How to update posts’ custom taxonomy selection?
- Conditional formatting on data fetched from MYSQL
- How can i create a function tag in my plugin
- Find and print first entry from WordPress post in custom excerpt?
- Adding if statement
- Display specific page if user signed in
- Permalink like example.com/taxonomy/post_type/postname
- How to insert text into post based on category – via single.php file
- Displaying child taxonomy before parent
- Get Posts by Custom Taxonomy on Custom Post
- New term taxonomy and description in front page. Input’s
- str_replace not preserving whitespace
- Widget Logic – display on page and all child
- How to associate dynamic PHP page for chosen WordPress tag?
- How to replace hard-coded list of custom taxonomy terms based on custom field query [closed]
- How to hide the Duplicate taxonomy values in WordPress?
- Custom Taxonomy Link Text Echo Name Not Slug
- if user is admin display admin link and logout link else display logout only
- Limit Taxonomy Parents
- How to define Og Meta Tags in header using conditions [duplicate]
- Get category id for a custom category and display it in a class
- wordpress taxonomy in regular posts
- Load slideshow.css file only if Slideshow is checked / on
- Custom taxonomy with page post type – WordPress
- Query posts by custom taxonomy slug in WP REST API?
- advanced custom fields: repeater field within conditional statement [closed]
- How to make multiple custom taxonomies sit under custom post type slug?