• Hello:

    I am working on a WordPress website with a complex posts structure.

    Posts should be categorized in a certain taxonomy, which contains another taxonomy, and then the last taxonomy includes certain authors.

    Eg: Main category > Subcategory > sub-subcategory > post (with a list of authors linked only to the sub-subcategory)

    How can I do this?

    I am trying CPT UI plugin but it does not seem to have the conditional logics I need.

    Thank you in advance.

    • This topic was modified 2 years, 6 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    One taxonomy cannot “contain” another. Each stands in its own right. However, a taxonomy can be hierarchical, so the main, top level terms can have child terms, and the children can themselves have their own child terms. And so on. All terms belong to the same taxonomy though.

    You can also assign terms from multiple taxonomies to any particular post. While each taxonomy is independent of another, you can construct post queries that require certain terms from various taxonomies. The query logic used can be quite complex even if each taxonomy’s organization is very simple.

    The choice of whether to use a hierarchy and/or multiple taxonomies depends on what sort of organizational structure you want.

    Thread Starter princesuxx

    (@princesuxx)

    Actually, there are articles written by several authors. Those authors belong to a certain subject, and the subject belongs to a certain territory.

    For example:

    Subject 01
    – Territory 01
    —- Subject 01
    —- Subject 02
    ——– Author 01
    ——– Author 02
    – Territory 02

    In the article, users should be able to click on the author name and see what Subject and what Territory it belongs.

    Maybe there is a plugin for this?

    Thank you in advance.

    Moderator bcworkz

    (@bcworkz)

    In a hierarchical taxonomy, you can get ancestor terms of any term (other than top level of course). In your hierarchy example, you can get subjects and territories of either author that are in its branch of the hierarchy. It works the other way too, getting children of a term. Like authors under a particular subject.

    Does it make sense to have subjects, territories, and authors in the same taxonomy? It’s up to you. But if you use different taxonomies, there’s not a direct relationship between terms like there would be with ancestors/children. Relations between taxonomies would need an externally defined relation like through the post they’re assigned to, or some sort of custom meta value.

    By way of meta values, you could in a sense contain one taxonomy within another. At least abstractly, though not literally. An author term in one taxonomy could refer to a subject term in a different taxonomy. WP doesn’t provide for meta value relations by default, but it can be custom coded to work.

    I’m sure there are plugins that would help you define custom taxonomies, but I’m unsure if any would provide for meta value or other sorts of inter-taxonomy relations. It’d be worth doing some searching all the same.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Create a custom category/taxonomy structure’ is closed to new replies.