Skip Navigation

[Closed] Filter a view by child post taxonomy

This support ticket is created 7 years, 9 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 5 replies, has 2 voices.

Last updated by Shane 7 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#419377

I am trying to:
Filter a view by a child post taxonomy

I visited this URL: hidden link

I expected to see:
The posts filtered by the child State and Discipline taxonomies on the child post type Approvals.

Instead, I got:
The posts are not displaying based on Approval State and Discipline taxonomies

In this case the view is displaying Products. Each product has several Approval child posts. Both the Products and the Approval post types use the taxonomies State and Discipline (but for 2 different purposes)

In this view I want the State and Discipline select fields to look into the Approval Child Post, not the Product itself

This is how I have setup the view's search (the slug of Approvals is "hceu-approval")

[wpv-filter-start hide="false"]
[wpv-filter-controls]<div class="one-fourth first">[wpml-string context="wpv-views"][/wpml-string] [wpv-control taxonomy="states" id="$hceu-approval" url_param="wpvstates" type="select" default_label="State" hide_empty="true"]

</div> <div class="one-fourth">[wpml-string context="wpv-views"][/wpml-string] [wpv-control taxonomy="discipline" id="$hceu-approval" url_param="wpvdiscipline" type="select" default_label="Discipline" hide_empty="true"]

</div> <div class="one-fourth">[wpml-string context="wpv-views"][/wpml-string] [wpv-control field="format" url_param="format" type="select" auto_fill_default="Format" auto_fill="wpcf-format" auto_fill_sort="asc"]

</div><div class="one-fourth">[wpml-string context="wpv-views"][/wpml-string] [wpv-control field="views_woo_on_sale" url_param="views_woo_on_sale" type="textfield"]
<br/><a href="#" class="promo-go">Add Promo Code</a></div>
<div style="clear: both"></div>
 [wpv-filter-reset reset_label="Reset Search Filters" style="background-color:#94a3a8" type="link"]
[wpv-filter-spinner container="div" position="before" spinner="<em><u>hidden link</u></em>"][/wpv-filter-spinner][wpv-filter-submit name="Submit" type="input"]
[read more="View Advanced Search Options" less="Hide Advanced Search"]
<div style="clear: both"></div>
<div class="one-fourth first">[wpml-string context="wpv-views"][/wpml-string] [wpml-string context="wpv-views"][/wpml-string] [wpv-control taxonomy="clinical-topic" url_param="wpvclinicaltopic" type="select" default_label="Clinical Topics" hide_empty="true"]
</div>
<div class="one-fourth">[wpml-string context="wpv-views"][/wpml-string] [wpv-control field="contact-hours" url_param="contact-hours" type="select" auto_fill="wpcf-contact-hours" auto_fill_default="Contact Hours" auto_fill_sort="ascnum"]</div>
<div class="one-fourth">[wpml-string context="wpv-views"][/wpml-string] [wpv-control taxonomy="target-audience" url_param="wpv-target-audience" type="select" default_label="Target Audience" hide_empty="true"]</div>
<div class="one-fourth">[wpv-filter-search-box placeholder="Search here"]</div>
<div style="clear:both;"></div> 
[/read]
[/wpv-filter-controls]
  [wpv-filter-end]<div style="clear:both></div> 
#419443

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Heather,

Thank you for contacting our support forum.

From your post I gather you have a Parent/Child relationship on your site.

Then you are trying to filter the Parent posts by the taxonomies of the Child posts using views correct?

Does the Parent CPT have the same taxonomies as the children ?

If not then you are not able to filter the parent view by the child post taxonomies.

Please let me know.

Thanks,
Shane

#419444

They have the same taxonomies, but different values for those taxonomies.

#419447

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Heather,

It wouldn't be possible either since the view can only sort based on the taxonomy terms that are attached to the current custom post type.

So a workaround to this could be that you allow the parent to have the same taxonomy terms as the child.

What is it that you are trying to achieve exactly, maybe I could brainstorm some ideas.

Thanks,
Shane

#419448

If we made those fields instead of taxonomies at the child level, could we filter by that?

#419451

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Heather,

I would need to know what you want to achieve first. Because this would pose the same issue as the taxonomy because the parents wouldn't have the same custom field values or not have the custom fields attached to it.

Look at it like this, if you are displaying the parent posts then you can only filter for attributes of the Parent and not for the child.

Even thought the posts are related in Types, technically they are still separate Post Types.

Please let me know if this helps.
Thanks,
Shane

The topic ‘[Closed] Filter a view by child post taxonomy’ is closed to new replies.