Skip Navigation

[Resolved] I need to show just the latest entry from a group of authors

This support ticket is created 4 years, 1 month 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
#1863371

Tell us what you are trying to do?

I have a site where an usergroup called "Wirte" are entering their daily menus via frontend form. Now i build a view for visitors where todays menus are shown and the view should just show the latest menu of each author (Wirt).

Is there any documentation that you are following?

various tutorials you provide.

Is there a similar example that we can see?

Nothing i am aware of

What is the link to your site?

hidden link
- this is the page with the output of the view i am trying to achieve this target

#1863605

Hi,

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

From your message, it is not clear whether the user group "Wirte" is a user role or a custom post type, connected to the menu post type.

Can you please share temporary admin login details, so that I can see how these items are set up? I'll be in a better position to suggest the next steps, accordingly.

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

regards,
Waqar

#1864717

Thank you for sharing these details.

For what you're planning, you'll need two views:

1. The first view will be a user view, which will loop through all the users with the "Wirte" user role.

2. Inside the loop of the first view, you'll nest a second post view, which will be set to show "Mittagsmenüs" posts, with a limit of 1 post, ordered by the descending post date (latest post). In the query filter this view will also have a post author filter with "Post author is set by the parent User View" option.
( example screenshot: hidden link )

We have a guide on using the nested views at:
https://toolset.com/documentation/user-guides/views/using-a-child-view-in-a-taxonomy-view-layout/

As for the second part of your question, you can use the conditional block to conditionally show the form to add a new "Mittagsmenüs" post, only if the count of existing "Mittagsmenüs" posts from the current user for today's date is less than 1.

For a calculation like this, you can create a new post view for the "Mittagsmenüs" posts, with today's date and the current user is the post author filter and set the view to output nothing but the count of found results, through the "wpv-found-count" shortcode:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-found-count

After that, you'll be able to use this view's shortcode in the conditional comparison:
https://toolset.com/documentation/legacy-features/views-plugin/using-shortcodes-in-conditions/

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

#1866215

Thanks for pointing me into the direction of "View in a View" - it works great, thank you!