• 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/)
    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.