Skip Navigation

[Résolu] How to show only the latest post from each author

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.

Marqué : ,

This topic contains 8 réponses, has 2 voix.

Last updated by Minesh Il y a 1 an et 1 mois.

Assigned support staff: Minesh.


On this website hidden link
I want to show only one article per author (antiquair).
In this website we have many authors. Each author has 1 or more articles.
In the upper view, I only want to show the 14 newest articles, but not more than 1 per author.
is this possible?

(in the second view we show them all, sorted on publish date.)



Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

It seems to me that you will require to use the nested view one user type view should loop through all the author users and another post type view that should help you to get the one post belong to that author.

As this will be nested views, you will not be able to sort the result based on the data but the author.

If you can share problem URL where you want to display those author post as well as access details I will setup a demo for you.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.



Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Thank you for sharing access details.

The thing is that either you can loop through the 14 new users and then per user we can display one article belongs to that user or either we can navigate to 14 latest articles irrespective of author.

I'm not sure now if you changed the plan as you added the post-relationship, if you can share what could be your expected output with test case example that will help me to guide you in the right direction.


Hi Minesh,

No, not changed plan, but maybe it is usefull?

My wish in the top view is:
The newest articles, but different authors. So, when an author published 3 new articles, we will skip number 2 and 3, only show the latest.

14 tiles (articles) from 14 authors, filtered on last published.
the relationship to antiquairs is mayby usefull in making a view?

than it would be:
14 tiles from 14 antiquairs, filtered on last published article.



Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

There is no such feature to display the result such way.

Because if you loop through the newest articles the view do not have mechanism to break the view in middle.

Here i've created the demo view:
=> hidden link

Which you can see on the frontend here:
=> hidden link

And I've added the "wpv_filter_query_post_process" filer to "Custom Code" section offered by Toolset:
=> hidden link

add_filter( 'wpv_filter_query_post_process', 'func_filter_display_1_post_by_author', 10, 3 );
function func_filter_display_1_post_by_author( $query, $view_settings, $view_id ) {
  if($view_id == 26086) {
    $post_authors = array();
    $count = 0;
    $all_posts = array();
    foreach($query->posts as $k=>$v):
          $all_posts[] = $v; 
          if($count > 13){
    $query->posts = $all_posts;
    $query->found_posts = 14; 
    $query->post_count = 14; 
    return $query;

As you can see the view displays only 14 posts and each post is belongs to unique author.


Hi Minesh,

This is not exactly what I was looking for. I can't add the latest article in the loop.

Is it not possible to work with an index?
I use that for the pictures in the second view.

I use your snippet now on hidden link



Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

I can't add the latest article in the loop.
I'm not sure how exactly you want to add latest article to loop.

Is it not possible to work with an index?
Its possible to target the specific loop index using the shortcode: [wpv-item index=1]

If you can setup a demo content and share what could be your expected output then I can review it and that will help me to guide you in the right direction.



I sent you 2 pictures.
I added the name of te antiquair below the article (thanks to the relationship)
This is what we like to have. Filter is removed, we don't need that here.



Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

I still not figure out from where the first image is displayed. I think its from the child post type "Artikelen" but even if the image is displayed from "Artikelen" post type, what is the reason that it should be displayed at first place with your "this-is-what-i-want.jpg".

The thing is that we do not have a way to group the posts by author until and unless either you use nested view or add custom query to filter your result.

If you use nested view where the top view will loop through the authors it will loop through all the authors and inside the author view we need to add post view that should fetch the posts belongs to that parent author passed by parent view and we can limit this inner view to display only 1 result.

I do not see any other way to group the post by author.