Recent post from users
-
Hi guys!
I’ve got a requst from my client, “Can we show the 4 most recent post from any user?” – That was easy. Done and done.
Next day my client comes back to me and would like to make a minor fix:
4 lastest post from users. A user can only appear once( only one post from a user, but still 4 most recent).
I’ve been struggling with this a while no so i hope you can help me.
Using a plugin, sorta looks like this
$user = get_userdata(15);
I’m requesting the id’s( get_userdata(15) ) with a simple mysql_query()
SELECT post_author, post_date FROM $wpdb->posts ORDER BY post_date DESC LIMIT 4
When im trying to select 4 unique users I use this query, but cant get it to work.
SELECT DISTINCT post_author, post_date FROM $wpdb->posts ORDER BY post_date LIMIT 4
Any good ideas to solve this?
cheers
- The topic ‘Recent post from users’ is closed to new replies.