Title: WordPress Posts Id from query_posts
Last modified: August 31, 2016

---

# WordPress Posts Id from query_posts

 *  [nosferas](https://wordpress.org/support/users/nosferas/)
 * (@nosferas)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/wordpress-posts-id-from-query_posts/)
 * Hi community,
    I’m using wordpress with a template that generates a pretty nice
   thumbnail for each post depending on ids, and type of post. (ref:[https://blinkdemo.wordpress.com/](https://blinkdemo.wordpress.com/))
   I have been asked to create a query for a template page that checks the page 
   slug and then list the posts containing a certain category + a tag (‘comparativas’).
 *     ```
       $args = 'cat='.$idCategory.'&tag=comparativas';
        query_posts( $args );
       ```
   
 * The problem that I’m facing is that the list of post presented on the page doesn’t
   show up the corresponding thumbnail on each post.
    Even when :`$current_id = 
   get_the_ID();` shows the correct Id if It’s echoed on the loop, I couldn’t make
   the template work properly.
 * Thumbnails are generated dynamically basically with these lines:
 *     ```
       $post_id = $post->ID;
           $thumbnail_id    = get_post_thumbnail_id( $post_id );
           $thumbnail_image = wp_get_attachment_image_src( $thumbnail_id,$thumbnail_size );
       ```
   
 * The problem is that I could’n find the way to send to the specific post ids to
   the function above, since the main`$wp_query->posts;` retrieves the page id instead
   of the post requested by the query_posts method.
 * Do you know how to retrieve the nested id’s or rewrite the values on the main
   $wp_query?
    If you have any clue that could help me to resolve this I will really
   appreciate it.
 * Thanks in advance

The topic ‘WordPress Posts Id from query_posts’ is closed to new replies.

## Tags

 * [Post_ID](https://wordpress.org/support/topic-tag/post_id/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * 0 replies
 * 1 participant
 * Last reply from: [nosferas](https://wordpress.org/support/users/nosferas/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/wordpress-posts-id-from-query_posts/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
