• Hi
    I use categories and custom taxonomy called ‘series’ (actually it’s the Organize Series Plugin that creates this custom taxonomy).
    I created a custom field called ‘category’ (field type is taxonomy) on the series add/edit page, so that each series will belong to a category.
    How do I list all series under a given category?
    I wrote a page template that displays the categories. When the user clicks on one of the categories, I want to display a list of series and a list of single posts under this category. How?
    Example output:

    – series 1
    post 1 (part of series 1)
    post 2 (part of series 1)
    + series 2
    + series 3

    post 3 (single)
    post 4 (single)

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m sorry but between not being familiar with Organize Series and the use of “category” as a meta field, which is easily confused with the taxonomy, you’ve totally confused me ??

    It doesn’t matter I think, the answer in any case is you create a custom query using a new WP_Query object. Specify whatever arguments you need to get what you want, in the order you want. However, ordering by taxonomy term is not natively supported, but ordering by post meta is possible. Thus you may need to make multiple queries if “Series” is a taxonomy term (or write your own SQL (using $wpdb methods) to order by taxonomy term).

    If posts can be ordered by series, you can detect a change in series within the loop to output any desired series header. Otherwise, step through the series terms and query for the posts individually.

    As for the remainder of posts not in a series, either exclude the series terms from the final query or compile an array of post IDs as they are output, then use that array as a “post__not_in” argument to avoid duplicate posts.

Viewing 1 replies (of 1 total)
  • The topic ‘get custom taxonomy terms of a category’ is closed to new replies.