Skip Navigation

[Resolved] Related posts dosent give me the View im going after.

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a View of posts that displays a table of information. In the last column, I would like to display information about the most recent related post.

Solution: Create two Views, one for displaying the table and another for displaying the related post. Nest the View of related posts inside the table View. In the View of related posts, add a post relationship Query Filter set by the current post in the loop, limit the results to 1 result, and sort by post date in descending order.

This support ticket is created 5 years, 10 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1225223
3.PNG
2.PNG
1.PNG

Hello,
Currently i am able to achieve this View see pic 1.Which is just one custom post of <JOB> and a Cred form called[Approval] inside the content template of a <JOB> that alters the values so it shows approved or rejected, pretty simple, which is was what i wanted.

Now i had to separate the Status field to another custom post called <APPROVES>. What i have now is two custom posts. <JOB> & <Approves> and they are related as one <JOB> to many <APPROVES>.

So basically what Im trying to show in the new View called-->[Admin All job] data entries from both posts same like before in Pic.1 but that wont happen. It shows me new posts from the <APPROVES> custom post [see pic 3].
Maybe im doing something wrong , should i change something in the view settings?.

Many thanks

#1225437

It sounds like you need to use two nested Views. The outside View will be a View of Jobs, with 4 columns. This outer View should not include the Approves post type. Then you will create a View of Approves, with a Post Relationship Query Filter set by the current post in the loop (i.e. the current Job). Nest this View of Approves inside the 4th column of the View of Jobs, and you will display a list of the Approves associated with the current Job.

#1225479

Hello Christian,
Nested view, is there any tutorial on this, or you could possibly try to explain the steps a little bit more detailed please as i have never tried this before. How do i add a view inside a view?

Thank you

#1225673
Track2.PNG

I see what you mean now.
The thing is i dont want to display a list of approves. The Cred form now creates new posts <Approves>.[Before it only edited the existing approve field to show current values for example reject or approve].
But now i changed the Cred form to publish <Approves> posts cause i am using it to track how many times a form was rejected or approved and display the dates of those posts as a list something like track history. Can i only display the last Status? The current status and not all of them. Same thing like the Pic 1 i attached. I will upload now a pic of what the form does.

#1225917
Screen Shot 2019-04-04 at 11.01.09 AM.png

The best approach is to use a View and limit the results. In the View editor screen, look for the Limit and Offset section. If you cannot find it, scroll up to the top right corner and click "Screen Options" to activate the Limit and Offset section. Set the limit to 1. Then in the Ordering section, sort the View by post date, descending order. Again if you cannot see the Ordering section you can activate it in Screen Options.

#1226153

My issue is resolved now. Thank you!

#1227235

Hello Christian,
A question regarding this topic, how can i filter results inside of search and pagination based on if its Approved or Rejected from nested views? It dosent give me any results.

Thank you for your help

#1227278

Hi, you cannot filter a View of Jobs based on information stored in related post type Approves in the current software, so you'll have to use another approach. One idea is you use custom code to set a custom field value in the Job post whenever an Approval is accepted or rejected. You can do this with the Forms API cred_save_data: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
If you need more detailed assistance implementing this API, feel free to open a new ticket and we will be glad to help.