WordPress no-plugin show newest,hot,random post


Show newest post:

<ul><?php $post_query = new WP_Query(‘showposts=10′);

while ($post_query->have_posts()) : $post_query->the_post();

$do_not_duplicate = $post->ID; ?>

<li><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></li>

<?php endwhile;?>


Show hot post:


$post_num = 10; // set post number

$args = array(

‘post_password’ => ”,

‘post_status’ => ‘publish’, // just show published post.

‘post__not_in’ => array($post->ID),//exclude current post

‘caller_get_posts’ => 1, // exclude sticky post

‘orderby’ => ‘comment_count’, // post order by comment count

‘posts_per_page’ => $post_num


$query_posts = new WP_Query();


while( $query_posts->have_posts() ) { $query_posts->the_post(); ?>

<li><a href=”<?php the_permalink(); ?>” title=”<?php the_title(); ?>”><?php the_title(); ?></a></li>

<?php } wp_reset_query();?>


Show random post:



global $post;

$postid = $post->ID;

$args = array( ‘orderby’ => ‘rand’, ‘post__not_in’ => array($post->ID), ‘showposts’ => 10);

$query_posts = new WP_Query();



<?php while ($query_posts->have_posts()) : $query_posts->the_post(); ?>

<li><a href=”<?php the_permalink(); ?>” rel=”bookmark” title=”<?php the_title_attribute(); ?>”><?php the_title(); ?></a></li>

<?php endwhile; ?>


Readers Comments (5)

  1. Thank you for every other informative web site. The place
    else could I am getting that kind of info written in such a perfect approach?
    I’ve a venture that I’m just now operating on, and I’ve
    been at the look out for such information.

  2. It’s difficult to find knowledgeable people for this topic,
    but you sound like you know what you’re talking about!


  3. Does anyone knoѡ іf Vapeology, LLC ([email protected]сom) sell CBD vape?

  4. I read this paragraph completely pertainng to the resembkance of newest
    and prior to technologies, it’sawesome article.


Leave a comment

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.