Skip Navigation

[Resolved] sub taxonomy?

This support ticket is created 5 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by Ido Angel 5 years, 10 months ago.

Assisted by: Waqar.

Author
Posts
#1186259

hey,
i have a post type called "writers". it has a taxonomy called "city". but i want to divide this to "city of birth" and "city of death". both birth and death cities will be "cities" - i want that in the "city" taxonomy archive i would be able to see both writers who were born then, and writers who died there. and of course i want this divided inside the taxonomy archive:

writers who lived here:
a,b,c,d etc

writers who died here:
a,d,f,g etc

i tried:
creating a new post type called "dead writers" and assign the taxonomy "city" to both "writers" post type and "dead writers" post type. i created a relationship between these two types. but when i created the archive, well, two strange things happened:

1. it showed me all in a mix (writers and dead writers), and i couldn't distinguish between them
2. i wanted all links to lead to living writers (as "writers" is the main post type in this index), but when i tried changing the loop into something like

<a href="<em><u>hidden link</u></em>;">[post-title]</a>

... the archive just didn't change! as if it was sourcing from a different archive.

anyway - is there a better way of doing this?
thanks!

ido

#1186712

Hi Ido,

Thanks for asking! I'd be happy to help.

By default, there is no natural way of grouping terms within the same taxonomy (e.g. City), into sub-groups (e.g. "city of birth", "city of death" etc). For this reason, I wouldn't recommend this approach, as it will involve too many workarounds or customizations.

The more natural way of achieving this would be creating two different taxonomies, one for "Birth City" and other for the "Death City". This will also give you taxonomy based archives for writers CPT, based on where they were born or died.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1186719

Thx waqar!
I know 🙂 but this solution won't help me gather all info about a city in an archive, eg writers who were born and dies here - to get.
Any idea?

#1186768

Hi Ido,

If you'd like to keep the "city" as a singular main entity for archives, you can consider a different approach:

1. Keep the "City" taxonomy and add all city names as its terms.

2. Add two select type custom fields to "writers" CPT "Birth City" & "Death City" and use "wpt_field_options" filter to automatically generate the select options for these two fields from the "City" taxonomy.
( ref: https://toolset.com/forums/topic/filling-a-select-box-from-terms-in-a-taxonomy/ )

3. As a result, while adding/editing a writer, you'll be able to specify where he/she was born or died, through these new custom fields.

4. Finally, in your main archive view for the city taxonomy, you'll be able to show which writer was born or died in each city, through two separate nested post views (for writers CPT).

Here is a very relevant guide on nesting views within one another:
https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/

regards,
Waqar

#1187436

Thanks Waqar!

I'll give this a try 🙂

Cheers,

Ido