i want to make very simple thumbnails grid 4 or 5 images only to show the latest sticky posts with " shortcode to be easy add anywhere "


  • And at what point exactly did you get stuck? Please show us your code, make you question as specific as possible. In its current form it is way too broad. See How to Ask.
    – fuxia
    Commented Apr 8, 2018 at 10:00

1 Answer 1


I found it.

<div class="trending-right">
 $sticky = get_option( 'sticky_posts' ); // Get all sticky posts
 rsort( $sticky ); // Sort the stickies, latest first
 $sticky = array_slice( $sticky, 0, 6 ); // Number of stickies to show
 query_posts( array( 'post__in' => $sticky, 'caller_get_posts' => 1 ) ); // The query

 if (have_posts() ) { while ( have_posts() ) : the_post(); ?>
 <div class="trend-post">
 <div class="thumb"><?php the_post_thumbnail(array(100,100)); ?></div>
 <div class="title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></div>
 <?php endwhile;?>
 <?php } else { echo ""; }


I used this code inside header.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.