WordPress.org

Support

Support » How-To and Troubleshooting » Boolean taxonomy

Boolean taxonomy

  • How would one register a Boolean taxonomy? For instance it’s either ‘in stock’ or ‘sold out’. I want to explicitly say so I can display post based on it. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • esmi

    @esmi

    Forum Moderator

    And where are the variables “stock” and “sold out” stored?

    It’s not a variable. I would like it as a taxonomy in my custom post type plugin so I can take advantage of all the beauty taxonomies have to offer. But with hierarchal they can select both and flat all I get is a text field. What I would like is either radio buttons or a drop down.

    Worst case I can use post meta but then I lose the advantages of a taxonomy. But is that my only option?

    I’m looking for similar information in order to filter a function (using if, elseif etc) based on the post having a particular custom taxonomy value.

    Say for instance I wanted to change the postfooter based on the custom taxonomy ‘location’ having a particular value eg London.

    If it was a tag I could use ‘has_tag()’. If it was a category I could use ‘in_category()’.

    But how do I achieve a Boolean operation with taxonomies? I know about ‘taxonomy_exists()’, but haven’t managed to track down a way to make it work in that way.

    Any takers? 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Boolean taxonomy’ is closed to new replies.
Skip to toolbar