Skip Navigation

[Résolu] list child posts based on parent's taxonomy

This support ticket is created Il y a 7 années et 7 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 17 réponses, has 3 voix.

Last updated by Minesh Il y a 7 années et 7 mois.

Assisted by: Minesh.

Auteur
Publications
#430983

I am trying to: create a view that lists child posts based on their parent posts' taxonomy

I visited this URL: https://toolset.com/forums/topic/filter-posts-by-taxonomy-of-parent-post/

I expected to see: an answer

Instead, I got: the final post says something about creating 3 views, but doesn't explain how to do it.

#431193

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Could you please list down your Parent/Child CPTs and taxonomy information with one dummy example exactly what you want to display so that I'll create one test case for you to guide you exactly how you can achieve this.

#431289

Hi,

I have some custom post types: actors, movie sets and performances
actors and movie sets are parents, performances is the child that acts as the intermediary to create the relationships

the parents have their own categories
i.e. an actor can be tagged with 'comedic'
i.e. a movie set can be tagged with 'outdoors'

i'd like to create a view that lists all the performances with actors tagged as comedic
(this view could go on the main home page)
basically, the child inherits the taxonomy of its parent

**also, a related problem i'm trying to solve:
i'd like to put a view on each performance post, that lists all performances whose parents are tagged with the same categories to the current post
i.e. if the current performance post has an actor parent tagged with 'dramatic', then list performances whose actors are tagged with dramatic

Thanks for your help!

#431381

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

I would like to review your current setup.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#431398

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

I do not able to see toolset menu in admin section as well as plugins etc..etc..

Could you please grant me full rights to user you create for me so I can review setup with Toolset.

#431406

Updated.

#431414

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

I would like to confirm that for CPT performance, I can see that CPT Artist and CPT Venue set as Parent. I do not see any movie CPT.

As I can see there is Genres taxonomy attached to CPT Artists and CPT performance. Do you mean that you want to list all performances for which Artist belongs to specific taxonomy term. For example 'country'?

Which taxonomy term you would like to list post with? For example, there are four Artists posts to which 'country' taxonomy term attached. so you would like to display child (performances) that belongs to this four Artists posts?

#431420

Hi Minesh,

the movie/actors was just an example (it's just artists, venues, performances)

yes, i'd like to be able to list all performances where artists is tagged with a specific genre (i.e. show all performances that have a parent artist tagged with country). this view could be placed on the home page or on a page that just displays the performances for a specific genre.

also, if i'm on a particular performance post, i'd also like to create a view where i can list all related performances based on the artist's genre. so if the current performance's artist is tagged with rock, then list other performances whose artists are tagged with rock.

thanks.

#431895

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

You should try to follow the following step:

1)
=> Create view 'performancesofparent'
=> Content selection "Performance"
=> add query filter: Post relationship filter
-- Select posts that are a children of the current post in the loop.
=> Add post title to your views loop output section: for example:

<wpv-loop>
          <li>  [wpv-post-link]</li>
</wpv-loop>

=> Save your view

2)
=> Create view "parentartist"
=> Content selection "Artists"
=> add query filter: select your taxonomy filter and select your taxonomy term for which you want to display post
=> Add 'performancesofparent' to loop output section

<wpv-loop>
          <li> [wpv-post-link] </li>
          [wpv-view name="performancesofparent"]
		</wpv-loop>

=> Save your view
=> Create a new page and add 'parentartist' view to pade and display the page

#431914

This doesn't seem to work for me. Did you get this working?
It shows the Titles of the Artists, but not the performances associated with them. It says no items found.

I'm surprised this is so difficult to do.

As well, I've found a bug:
When I tried to select filter by taxonomy in step 2), it wasn't in the drop down.
BUT, if I switch the Content Selection to Taxonomy and then back to Post type, then it was available in the drop down,

#431915

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - I try to create test example on my test install and its working.

I suggest you should go through our views training course "part 8 " and "part 9" important in your case:
=> https://toolset.com/documentation/user-guides/getting-started-views/

Once you get understanding about post relationships - please make sure you create right relationships between CPTs:

Create a test site on discover-wp.com with your required CPT and taxonomies:
=> https://toolset.com/faq/how-and-why-to-create-a-test-site-in-discover-wp/

You can play with our reference sites to get more understanding about views:
=> http://discover-wp.com/site-templates/

Once you create your CPT and taxonomies with proper data, try to follow the steps I shared in the previous post and create views and display it.
=> https://toolset.com/forums/topic/list-child-posts-based-on-parents-taxonomy/#post-431895

if still it does not work, share access details of discover-wp.com test site:

#432913

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

You need to create multiple views for that as I've explained here:
=> https://toolset.com/forums/topic/list-child-posts-based-on-parents-taxonomy/#post-431895

#433106

The instructions you provided worked, but only if I check off which categories to filter for:

=> add query filter: select your taxonomy filter and select your taxonomy term for which you want to display post

What if I want to dynamically use the categories of the current post's parent?

#433588

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+01:00)

Hi Jeff

I just wanted to update you that today is a holiday for Minesh and he will be back on the case tomorrow.

Sorry for the delays, we appreciate your patience.

#433939

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please tell me where you added your view - Could you please share problem page URL?

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.