Title: Wrong post order when modifying the_post_thumbnail
Last modified: August 22, 2016

---

# Wrong post order when modifying the_post_thumbnail

 *  [webenji](https://wordpress.org/support/users/webenji/)
 * (@webenji)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/wrong-post-order-when-modifying-the_post_thumbnail/)
 * I am a fairly recent wordpress user and came across a weird problem: the order
   of my posts is wrong on my category pages. I am using the theme Emphaino, which
   displays posts in 3 columns. The first row of 3 columns is fine, but the first
   two posts of the second row are reversed. Please see [http://mcbalaguer.com/?cat=29](http://mcbalaguer.com/?cat=29)
   for an example, where you will see that posts “Boulder, Colorado” and “Utah” 
   are reversed.
 * After some debugging, I tracked the problem down to the function the_post_thumbnail()
   inside the theme’s content.php:
 *     ```
       <?php if( has_post_thumbnail() ): ?>
           <div class="featured-image">
               <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
               <?php if( 'one_col_excerpts' == get_theme_mod('posts_layout') )
                   the_post_thumbnail();
               else
                   the_post_thumbnail('half-width'); // PROBLEM!
               ?>
               </a>
           </div>
       <?php endif; ?>
       ```
   
 * Basically, I want the pictures to approximately be their original resolutions
   at ~278×371. The weird thing is that I can get the posts to show in the right
   order if I change the parameter of the_post_thumbnail.
 * More specifically, the following changes make the post appear in the correct 
   order (but the images are too small):
    the_post_thumbnail(array(300,300)) the_post_thumbnail()
   the_post_thumbnail(‘medium’) the_post_thumbnail(‘thumbnail’) the_post_thumbnail(
   array(278,309)) These exhibit the same problem that I have described: the_post_thumbnail(
   array(278,371)) the_post_thumbnail(array(225,371)) the_post_thumbnail(array(278,310))
 * It seems that the size of the image is what causes the post order to be messed
   up, but I could not figure out why. Analyzing the page shows that an inline style
   parameter gets added to the article tag, which sets (incorrectly in my example)
   the left parameter. I could not figure out where that inline style parameter 
   came from…
 * Any help would be greatly appreciated.

The topic ‘Wrong post order when modifying the_post_thumbnail’ is closed to new 
replies.

## Tags

 * [order](https://wordpress.org/support/topic-tag/order/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [the_post_thumbnail](https://wordpress.org/support/topic-tag/the_post_thumbnail/)
 * [thumbnail](https://wordpress.org/support/topic-tag/thumbnail/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [webenji](https://wordpress.org/support/users/webenji/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/wrong-post-order-when-modifying-the_post_thumbnail/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
