Display most popular with WP_Query
-
Hi all
Is it possible to display the most popular posts using a WP_Query
This is the code I’m using to display posts.
<?php $idea_args = array( 'post_type' => 'post', 'order' => 'ASC', 'post_status' => 'delivered' ); $idea_loop = new WP_Query($idea_args); if($idea_loop->have_posts()): while($idea_loop->have_posts()): $idea_loop->the_post(); ?> <a href="<?php the_permalink(); ?>"> <div class="ideasContainer__idea"> <h3><?php echo the_title();?></h3> <p><?php echo the_content(); ?></p> </div> </a> <?php endwhile; endif; ?> <?php wp_reset_postdata(); ?>
I would like to create this html structure but for the most popular posts
<a href="<?php the_permalink(); ?>"> <div class="ideasContainer__idea"> <h3><?php echo the_title();?></h3> <p><?php echo the_content(); ?></p> </div> </a>
Can I query the Like Button in the query or how would I create this html structure while displaying the most popular post.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Display most popular with WP_Query’ is closed to new replies.