WordPress.org

Ready to get started?Download WordPress

Forums

Boolean taxonomy (4 posts)

  1. lerizzle
    Member
    Posted 3 years ago #

    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!

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    And where are the variables "stock" and "sold out" stored?

  3. lerizzle
    Member
    Posted 3 years ago #

    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?

  4. Bob33
    Member
    Posted 3 years ago #

    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? :)

Topic Closed

This topic has been closed to new replies.

About this Topic