Skip Navigation

[Resolved] I cannot manage to make a view within a view display only desired list of items

This support ticket is created 4 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 – 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)

Author
Posts
#1618741
Capture d’écran 2020-05-10 à 15.18.22.png
Capture d’écran 2020-05-10 à 14.55.51.png
Problem.jpg

Dear Toolset support team,

It's been a while I haven't used your plugin and I am getting back into it...I hope you can help me..

PROBLEM DESCRIPTION
I am trying to display a list of article series and within each serie, display the list of articles which relate to the same taxonomy than the Serie itself. See my explanation on the image enclosed.
I am at the stage where I can display the list of series, I have also managed to display a list of articles(posts) under each serie, but I would like this list of articles to be limited to the articles which share the same taxonomy as the Serie. Any quick help would be highly appreciated.
STEPS ALREADY TAKEN
For reference: here is the list of what i have done so far:
- create a custom post type => Series
- create a group of custom fields associated with the above mentioned CPT to display additional information relating to each Serie
- create a new taxonomy => Topics and created the necessary amount of terms within that taxonomy (Topic AA / Topic BB / Topic CC)
- assigned each existing article (created using the WP Post type of content) to one term of the Topic taxonomy
- assigned each existing Serie to one term of the Topic taxonomy
- create a view meant to list all articles (see screenshot enclosed) => View2
- create a content template using the blocks editor which contain the main view (View1) meant to display the list of Series and the related fields
- embed the View2 within the View1
- created a page to display the result in Divi
- assign the content template to that page
THE RESULT I HAVE:
- The Series appear as expected
- the View2 indeed displays a list of articles, but ....
It displays the entire list of existing articles!!!
I have also tried to use a query filter when creating the view, but in that case, I get the exact same restricted list of articles for each serie....
I also want to avoid having to create as many pre-filtered views as I have Series...as this means that my client would have to ask me to create a new view every time she would create a new Serie or a new taxonomy so I want to find a solution which makes it possible to automatically detect which articles should appear under each Serie based on the taxonomy term associated to both the article and the Serie.
I hope that my explanation is clear enough for you to help me with this...
POSSIBLE BUG WORTH MENTIONING:
Also worth saying that trying to embed a view within the main view straight from within the Block editor systematically returns an error message (see enclosed screenshot) so I had to create the View2 (to list the articles) using the View menu on the WP dashboard and then select the existing view from within the content template.

#1619047
Capture d’écran 2020-05-11 à 00.20.51.png
Capture d’écran 2020-05-11 à 00.32.48.png
Capture d’écran 2020-05-11 à 00.33.50.png
Capture d’écran 2020-05-11 à 00.37.37.png
Capture d’écran 2020-05-11 à 00.38.07.png

So I wish to add to the above explanations that after having spent the entire Sunday on this issue, it is still not resolved and I start to get really frustrated...I have now understood that I am supposed to create a parent-child relationship of one to many between my Series and my articles(posts) content types, which i have done. Then I have added a Query filter as you can see on the screenshot enclosed, but I still get the entire list of articles displayed on the front-end instead of the expected list restricted to the posts that are children of the serie in the loop....No idea what to try next...please urgently help...

#1619093
Capture d’écran 2020-05-11 à 01.03.12.png
Capture d’écran 2020-05-11 à 01.04.10.png

I have also tried the below solution as a query filter...but still no success...I also enclose the structure of my layout..just in case...

#1619525

Hi,

Thank you for contacting us and I'd be happy to assist.

First, your observation is correct and currently the Blocks based views editor, doesn't support nesting of views. For this reason, whenever nested views are involved, the classic views editor should be used.

For the original set up, when you were using a common taxonomy "Topics" for connecting "Series" and "Articles" posts, you can filter the nested view that shows "Articles" posts, based on the target taxonomy term's slug, passed in the shortcode attribute:
https://toolset.com/documentation/user-guides/views/passing-arguments-to-views/#filters-by-taxonomies

Example Screenshot from the nested/child Articles view:
hidden link

And in the parent view that shows the Series posts, you can pass on the target "Topics" terms' slug, in the shortcode of the nested view, using the shortcode "[wpv-post-taxonomy type='topic' format='slug']".

Example Screenshot from the parent Series view:
hidden link

As a result, the articles view will only bring in those posts, where the taxonomy is the same as the one attached to the current series post.

On the other hand, if you've decided to use post relationships for connecting Series and Articles, please make sure that:
a). any taxonomy filters from the previous approach have been removed and
b). "The current post in the loop" option is selected in the query filter settings of the nested view ( screenshot: hidden link )

Here is a guide on showing related posts when using the post-relationship:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/

I hope this helps and please let me know how it goes.

In case you're still having any difficulty in showing related posts, you're welcome to share temporary admin login details in reply to this message, along with the link to an example page.

Note: Your next reply will be private and though no changes will be made on your website, please make a complete backup copy, before sharing the access details.

regards,
Waqar

#1619867

Hi,

Thank you for sharing these details.

I've checked the view "Testview2" and it seems that the query filter setting for the relationship have no effect.

With a similar setup and post relationships, I couldn't reproduce this behavior on my test website though.

This suggests that this is something specific to your website only and I'll need it clone/snapshot to investigate this on a different server, without affecting the actual website.

I've set your next reply as private again and here is a guide on sharing a duplicator package:
https://toolset.com/faq/provide-supporters-copy-site/

Note: For now, as a workaround, you can try creating both parent and child views using the classic editor, and without involving the new block's editor.

regards,
Waqar

#1619879

Hi Wakar,

To which email address should I send the files (copy of my website)?
Thanks / Francine
EDIT: so I have sent both files to hello@toolset.com via wetransfer. In case you are at the end of you shift, please relay my request to one of your colleagues as I really need a solution quickly. I am supposed to renew my subscription in 2 days and if toolset does not fit at all with Divi, I will have to cancel it as there is no point having such a tool and being unable to achieve what I want with it...

#1619931

Hi,

You don't have to send the duplicator package to any email address.

As mentioned in step 4 ( https://toolset.com/faq/provide-supporters-copy-site/ ) you can upload the package's files, to any file sharing service (like Dropbox, Google Drive, etc) and share its link in the field for the duplicator package in your reply.

Note: Since I already have the admin access details, with your permission, I can also directly download the duplicator package from your website.

regards,
Waqar

#1619933

ah...ok...sorry then, I have just sent the files via wetransfer, but then ignore that and feel free to download them from my admin dashboard...thank you! your help is really appreciated and I hope that you can find a solution, really!

#1620965

Hi,

Thank you for the permission to download the duplicator package.

I've deployed it on my server and currently performing some tests on it

I'll be able to share my findings within the next couple of hours.

Thank you for your patience.

regards,
Waqar

#1620981

Hi,

During troubleshooting, I noticed that the "wpv-control-post-relationship" shortcode is inserted in the "Search and Pagination" section of the view "Testview2".
( screenshot: hidden link )

This shortcode should be used only when using the front-end search filter for post relationships.

For this view, we only need the static post relationship filter, so removing this shortcode block, fixes this issue.

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

regards,
Waqar

#1621359

Thanks a lot Wakar for your help, I was really getting worried but feel now relieved. For the sake of my own understanding, do you have any guess of what I could have done wrong to have that shortcode appearing there? Also, do I have to keep this part of the code? not sure why it is hide="false"...but there is no visible filter on the page and also not sure why we keep the filter-controls tag with nothing in between the opening and closing tag.... Toolset is still full of mysteries for me...
[wpv-filter-start hide="false"]
[wpv-filter-controls]
[/wpv-filter-controls]
[wpv-filter-end]