How you can show the variety of articles revealed per person excluding customers who don’t publish articles. My message kind is recipe. I wish to obtain a code to get there in wp-query
thanks very a lot on your assist
I offer you a bit of code.
Because of this code I’m able to show the full variety of recipes, however I’d have favored to have this:
Person A posted 14 cooking recipes, Person B posted 2 cooking recipes
ect..
person member1 ought to have 2 recipes
<?php
// 1. We outline the arguments to outline what we need to recuperate
$args = array ( 'post_type' => 'recipe', 'posts_per_page' => '16', );
// 2. We run the WP Question
// The Question
$the_query = new WP_Query ($args);
// 3. we show the variety of messages and the authors!
// The Loop
if ($the_query-> have_posts ()) {
echo count_user_posts (2, $args);
echo 'recipes for';
echo get_the_author (2, $args);
echo '<br>';
echo count_user_posts (1, $args);
echo 'recipes for';
echo get_the_author (1, $args);
// 3. We launch the loop to show the articles and the authors!
// The Loop
echo '<ul>';
whereas ($the_query-> have_posts ()) {
$the_query-> the_post ();
echo '<li>'. get_the_title (). '<li>';
echo '<li>'. get_the_author (). '<li>';
}
echo '<ul>';
}
else {
// no posts discovered }
/ * Restore authentic Publish Information * /
wp_reset_postdata ();
?>