Skip Navigation

[Resolved] view is showing all children instead of filtering by parent

This support ticket is created 7 years, 5 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.

This topic contains 5 replies, has 2 voices.

Last updated by Beda 7 years, 5 months ago.

Assigned support staff: Beda.

Author
Posts
#297955

I am using this page to see the PARENT posts for my Newsletters:

hidden link

On this page, I can see all the Parent posts, and I should be able to click on the VIEW ISSUE link which passes a URL parameter to another page where I have a view that shows the CHILDREN for that post.

The URL passes fine - for example:

hidden link

But even though it specifies to only shows posts that are children of 13674, it shows the same items as if the URL says 13643.

Can you help me figure out how to set up my filter so that I only see the child posts for one parent at a time?

Thanks!

Elise

#298115

Thank you for contacting us here in the Support Forum. I will try to help you as quick as possible to solve this situation.

You will be able to achieve this by following this steps:

1. Create the Parent Post type + Child Post type, and make sure the child post type has the correct parent post type assigned.

2. Create your parent post types and by doing so, at the Editors page bottom, add your child posts
(you can still edit them later in your Child Post Editor)
https://toolset.com/documentation/user-guides/creating-post-type-relationships/

3. Create a View that displays your Child Posts, add a Query Filter like this:

Select posts that are a children of the Post set by parent View.

==> Add (as example) a Title with Link in the Loop Output Editor
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/

4. Create a View that displays the parent posts, don’t include any filters
==> Add a table with the Loop Wizard, and choose wich fields to display
https://toolset.com/documentation/user-guides/digging-into-view-outputs/
https://toolset.com/documentation/user-guides/view-layouts-101/

==> Scroll to the Template of this view editor, and change the value of the <td></td> item
(wehre your link to the child item should appear)
to display your previously created Child View like this (example):

<td>[wpv-view name="view-child-posts"]</td>

5. On a page where you want to display the table with the paren posts that include the link to the child posts, include the lastly created view

6. On the front end you’ll now have something like here:
hidden link

7. The last item on the right will be a Title of the according child posts, linked to the child post

I tested this on my local install and it correctly returned the Chid Post content according to the loop.

If this does not work accurately on your install, can you please share a screenshot of your view(s)?

Sometimes screenshots illustrating what you are doing may go a long way to clarify what words fail to transmit, so if you like, make use of "upload an image" below the comment area.

Please let me know if you have further questions regarding the issue mentioned in this Thread
and let me know if the above solution works for you, I look forward to your reply!

Thank you

#298118

Thanks for all of this!

I've done the first two things (set up customs posts with a Parent/Child relationship and adding a couple of parent posts, each with some child posts.)

My Parent type is "Newsletters" and just has the info about which ISSUE of the newsletter (currently April and July). My Child type is "News Items" and is the individual articles that belong to particular issues.

Then I created a complicated view (at least, complicated for me!) that shows the issue custom field from a particular parent ("April 2015") - and then calls a couple of different views to show the child posts (separating them into a left column and right column view).

Here is the view I've created:

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<table align="center" width="850" style="border:1px solid #ffffff" cellspacing="2" cellpadding="2" >
<tr><td colspan="2">
<center>
<p><img src="hidden link" width="850"></p></center>
<h4 align="right">[types field="newsletterdatetext" id="$newsletters"][/types]</h4>
</td></tr>

<tr><td colspan="2" valign="top" bgcolor="#F3F3F3" style="border:2px solid #c0c0c0">
[wpv-view name="news-item-view-header"]
</td></tr>
<wpv-loop>

<tr>
<td width="35%" valign="top" bgcolor="#F3F3F3" style="border:2px solid #c0c0c0">
<br>[wpv-view name="news-item-view-left-column"]
</td>

<td width="65%" valign="top" style="border:2px solid #c0c0c0">
<br>[wpv-view name="news-item-view-right-column"]
</td>
</tr>

</wpv-loop>

</table>
<br><br><br>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

There is no filter set on this view ... but I've put a filter to "choose parent view" for the internal views that are nested in this view.

But I'm still getting something wrong.

Elise

#298142

Thanks for the Details

I would like to ask you if you could send me a export of your current view(s) via a service like DropBox or Google Drive?

This will enable me to import your View(s) to my test site, and fiddle around with it until I get it working 🙂

Do you know how to export your View(s)?

You can do that under Dashboard > Views > Import/Export

Just hit on "export" and send me the .zip that gets downloaded in your Browser

I will then re-download it from the Online storage you chose, and replicate it.

Eventually I will then send back a "working" version of it, or instruct you here with the required steps

Is this a good offer for you?

I will enable a private answer so you can share the link in private with me

Thank you for your cooperation.

#298178

That sounds like an amazing offer! But I managed to figure out how to make it work on my own ...

But I will definitely take you up on that offer the next time I'm having a problem with another page!

Thanks!

Elise

#298183

I'm happy you could solve it!

You're welcome anytime to contact us here to get support for your project.

I wish you the best success, thanks for choosing Toolset Technology!