How do I gee the numbered pagination of custom wpdb result?
below code will show one latest post from each authors in the site. I want to show 20 posts per page with a numbered pagination.
$postids = $wpdb->get_results(
"
SELECT a.ID, a.post_title, a.post_author, a.post_date
FROM $wpdb->posts a
JOIN (
SELECT max(post_date) post_date, post_author
FROM $wpdb->posts
WHERE post_status="publish"
AND post_type="post"
GROUP BY post_author
) b ON a.post_author = b.post_author AND a.post_date = b.post_date
WHERE post_status="publish"
AND post_type="post"
ORDER BY post_date DESC
"
);
foreach ( $postids as $postid )
{
//setup_postdata( $postid );
echo $postid->ID." :: ".$postid->post_title." :: ".$postid->post_author . "<br />" ;
//get_template_part( 'content', 'category' );
}