Title: Priority posts that have thumbnail
Last modified: August 20, 2016

---

# Priority posts that have thumbnail

 *  [jensmolsson](https://wordpress.org/support/users/jensmolsson/)
 * (@jensmolsson)
 * [14 years ago](https://wordpress.org/support/topic/priority-posts-that-have-thumbnail/)
 * Hello,
 * Do anyone know if it is possible with using **query_posts** to priority/order
   by posts that have thumbnail?
 * I have manage to sort out the once that have thumbnail but then I do not get 
   the once that does not. So I still want posts that have thumbnail and the once
   that does not just that the once that have thumbnail should be priority.
 * Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years ago](https://wordpress.org/support/topic/priority-posts-that-have-thumbnail/#post-2707394)
 * No – there’s no parameter for post_thumbnail.
 *  Thread Starter [jensmolsson](https://wordpress.org/support/users/jensmolsson/)
 * (@jensmolsson)
 * [14 years ago](https://wordpress.org/support/topic/priority-posts-that-have-thumbnail/#post-2707396)
 * Thanks for your answer Esmi.
    Is there a alternative way for doing this?
 * Thanks!
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years ago](https://wordpress.org/support/topic/priority-posts-that-have-thumbnail/#post-2707397)
 * You have to grab the post that you want and then run the results through some
   custom code that sorts the returned array of posts based on whether they have
   a post thumb or not.
 *  Thread Starter [jensmolsson](https://wordpress.org/support/users/jensmolsson/)
 * (@jensmolsson)
 * [14 years ago](https://wordpress.org/support/topic/priority-posts-that-have-thumbnail/#post-2707398)
 * Thanks Esmi. I will go for that 🙂
 *  Thread Starter [jensmolsson](https://wordpress.org/support/users/jensmolsson/)
 * (@jensmolsson)
 * [14 years ago](https://wordpress.org/support/topic/priority-posts-that-have-thumbnail/#post-2707497)
 * Here is the solution I used for this issue:
 *     ```
       //Post per page
       $post_per_page = 10;
       //Get all that have thumbnail
       query_posts($query_string."&posts_per_page=".$post_per_page."&meta_key=_thumbnail_id&orderby=meta_value&order=DESC");
       $posts = $wp_query->post_count;
       //Loop
       if ( have_posts() ) : while ( have_posts() ) : the_post();
   
       	//Content
   
       endwhile; endif;
   
       //Get the rest
       if($posts<$post_per_page) {
       	$showPoster = $post_per_page-$posts;
       	query_posts($query_string."&posts_per_page=".$showPoster."&order=DESC");
       	//Loop
       	if ( have_posts() ) : while ( have_posts() ) : the_post();
   
       	//Content
   
       	endwhile; endif;
   
       }
       ```
   

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Priority posts that have thumbnail’ is closed to new replies.

## Tags

 * [priority](https://wordpress.org/support/topic-tag/priority/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)
 * [thumbnail](https://wordpress.org/support/topic-tag/thumbnail/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [jensmolsson](https://wordpress.org/support/users/jensmolsson/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/priority-posts-that-have-thumbnail/#post-2707497)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
