I have a problem with WordPress widgets. I want to create a widget like in the images. I know how to create a widget but I don't know query and show the results as in the image.

Explain: We get 10 posts from a category, then show it as title 1 is the first post we get, then Title from 2-10 as in the images.

Could you please help me?

enter image description here

  • While in the loop just add some class to first post to distinguish it from other posts and style that as per your needs.
    – bravokeyl
    Commented Dec 6, 2016 at 10:43

2 Answers 2


Your question is a little short on detail, but let's suppose you have retrieved the posts using wp_query and are looping through it like this:

$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
    while ( $the_query->have_posts() ) {

In the position of STUFF you want to distinguish between the first post and other posts in which elements you want to retrieve. You can do this by accessing $current_post, which holds the number of the post inside the loop. You would get this:

if ($the_query->current_post == 0) {
  // retrieve featured image, title and content }
else {
  // retrieve title only }

as bravokeyl told , just try place counter and see if value is 1 , assign some special class and than add some css to that class .

other option may be enable sticky post in loop and than make your post sticky by editing from WordPress and assign css to that sticky article since that should have special class if it's created properly .

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.