• Resolved SimonJ

    (@simonj)


    Anybody have an idea how to make loop with a query posts with 1 post per author ?

    I mean, display a number of post on the front page, with only the last post from a given author… i.e. an author cannot have more than one post on the front page ?

    Thanks

    S,

Viewing 2 replies - 16 through 17 (of 17 total)
  • Correction; my previous funtion doesn’t order by date the way intended.

    function last_post_per_user()
    {
    	global $wpdb;
    
    	return $wpdb->get_results('SELECT post_author, post_title FROM '.$wpdb->posts.' INNER JOIN (SELECT MAX(ID) AS id FROM '.$wpdb->posts.' WHERE post_status=\'publish\' AND post_type=\'post\' AND post_author!=\'1\' GROUP BY post_author) latest ON wp_1_posts.ID = latest.id');
    }

    This SQL statement returns one item per author, sorted by the highest post ID for that user.

    I have found the simplest solution without using plugin and other custom loops. In case someone is interested, see the instruction here:
    http://www.dbuggr.com/smallwei/show-latest-post-author-wordpress-front-page/

Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘Query post to show one post per author ?’ is closed to new replies.