Skip Navigation

[Resolved] Filtering parent with child taxonomy

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
- 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 0 replies, has 1 voice.

Last updated by pierre-yvesC 2 weeks, 1 day ago.

Assisted by: Minesh.

Author
Posts
#2803906

Hi,

I know what I'm looking for has been already discussed here but I'm afraid I cannot get a way to make it work.

This seems to be what I want but I couldn't get it to work: https://toolset.com/documentation/legacy-features/views-plugin/displaying-related-child-posts/

This one looks good but the explanation is too short and Demo sites are discontinued: https://toolset.com/lesson-placement/lesson-placements-1824625-1727273/

Basically, I want to filter Parent post using Child taxonomy.

Here is what I'm trying to achieve:

Parent: Organisation
Child: Jobs
Child taxonomy: types of jobs (cooking, driving, etc)

In a view displaying Organisations with their related jobs, how can I filter only organisations which have "cooking" jobs?

Any help would be truly appreciated.

Many thx

#2803923

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

I woudld like to know you set your view to query what post type - Organization or Jobs?

Also, how you want to display the parent taxonomy filter - as select dropdown?

If you can share admin access details and problem URL once I review your current structue I will be able to guide you in the right direciton.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) 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 have set the next reply to private which means only you and I have access to it.

#2804054

Minesh
Supporter

Languages: English (English )

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

Where you added your view on what page and what view you created?

#2804095

Oh I'm sorry, I didn't provide all the info.

The page is: hidden link

The organisation view: hidden link

The nested jobs view: hidden link

BTW I tried to achieve it using blocks, with no more luck.

Thx again

#2804330

Minesh
Supporter

Languages: English (English )

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

I see you added two taxonomy filters where one taxonomy (filter) is attached to organization post type and another taxonomy (filter) is attached to Jobs post type.

Do you want to keep both taxonomy fitlers "Sector of Activities" and "Type of Jobs"?

#2804355

Hi Minesh,

Yes absolutely, I wish to keep both.

In fact, I will need many more filters (age, language, availability, etc), some for Jobs, some for organisations.

Thx for all

#2804360

Minesh
Supporter

Languages: English (English )

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

Actually, you can create a custom search view and add the filters for the custom fields, taxonomies for the post type you set to query.

To filter parent/child posts using the same view is not recommended because you can not add the parent frontend filters to the child view or viceaversa.

If you set your view to query "job" post type, then you can add filters using custom fields and taxonomy that are belongs to post type "job". But this will give you luxury to display related parent informtion for every job post as you have one-to-many post relationship with organizations and jobs post type.

#2804361

OK, i get I could have a view displaying filtered jobs and each job could display its parent info.

That's good.

Is there a way I can display all the jobs related to an organisation and the organisation info only once?

Like that:

Job 1 name (related to organisation 1)
Job 2 name (related to organisation 1)
Job 3 name (related to organisation 1)
Organisation 1 name

Many thx

#2804470

Minesh
Supporter

Languages: English (English )

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

Yes - but the catch here is that if you set your view to query post type "Jobs" then you can able to add custom search filter using custom fields and taxonomy belongs to post type "jobs". you will not be able to add search filters for custom fields and taxonomy for post type organizations.

I hope this is fine?

#2804932

OK, got it.

I see here you can pass data from parent to child but it doesn't work on my test site:
https://toolset.com/forums/topic/view-and-filter-for-taxonomy-of-children-posts/

Thx agai

#2804936
Untitled-10.jpg

I think I'm close to get what I want.

I miss the explanation to display jobs (child) related to the same organisation (parent).

See attached picture.

Many thx!

#2805123

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Minesh is on Vacation and I will answer this ticket for now.

From what I see Minesh already mentioned that with this method it is not possible to add filtering on the Organization and it is possible only for the Jobs.

Thanks.

#2805156

Hello Christopher,

Welcome on board.

Yes I'm aware it's not possible to fliter parent with child fields and vice-versa, I will handle it differently, with URLS reffering to another view/page.

My only concern is to have a view which display jobs within a job with same parent and withh same custom field filtering.

Should I start a new ticket?

Thx

#2805246

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Thanks, I hope I could understand the problem correctly, but from what I see you want to display a list of Jobs (child posts) that share the same Organisation (parent post) and meet specific custom field criteria.

If so I suggest this approach:

1. Create a View to Query 'Jobs' Post Type:

- Navigate to Toolset → Views and create a new View that queries the 'Jobs' post type.

- Enable custom search to allow filtering based on Job-related taxonomies and custom fields (e.g., Job Type, Age, Language).​

2. Add Filters Specific to 'Jobs':

- In the View's Search and Pagination section, add filters for the desired Job taxonomies and custom fields.

- Note: Filters can only be applied to the post type being queried—in this case, 'Jobs'.​

3. Display Parent Organisation Information:

- Within the Loop Editor of the 'Jobs' View, after displaying the Job details, insert fields to display information from the related Organisation.

- Use the Post Relationship shortcodes to fetch parent Organisation data. For example:​

[wpv-post-title item="@organisation-job.parent"]

This shortcode displays the title of the parent Organisation related to the current Job.

4. Group Jobs by Organisation:

- Use a nested View where the outer View queries 'Organisations' and the inner View queries 'Jobs' filtered by the current Organisation.

Please get back to us if that was what you asked for or not.

Thank you.

#2805266

Hello Christopher,

Thank you for your advice.

Yes this is what I want, I already understood the 1 to 3 steps but I must admit I'm stuck at step 4.

I made an Organisation view which contains a job view.

I put this Organisation view within the main view.

Now each organisation displays all jobs of all organisations. Which is far from what I want. I think I just need to setup the relationship between the nested views.

You can see it there: hidden link

Thx again!