Title: Wrong loop output
Last modified: August 31, 2016

---

# Wrong loop output

 *  Resolved [saburosakai](https://wordpress.org/support/users/saburosakai/)
 * (@saburosakai)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/wrong-loop-output/)
 * Hi, I’m working on a WordPress with TwentyTwelve theme installed.
    I’ve problems
   at this page: [http://iam.altervista.org/archalp/](http://iam.altervista.org/archalp/)
 * It should show all the thumbnails and titles of the posts of a category.
 * PROBLEMS:
    1 – Output in the wrong order. I don’t know why it starts from the
   center on the second row, and it doesn’t follow order by “date” or “number” atttribute.
   2 – The titles above the images sometimes are incomplete, infact not all of them
   shows the number of the image and its date. However if I open the post, the title
   is complete, so no information is missing from the database.
 * CODE:
 *     ```
       <header class="entry-header">
       <?php if ( ! post_password_required() && ! is_attachment() ) :
       	the_post_thumbnail();
       endif; ?>
   
       <?php if ( is_single() ) : ?>
       	<h1 class="entry-title"><?php the_title(); ?></h1>
       	<?php else : ?>
       	<h1 class="entry-title">
       		<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
       	</h1>
       	<?php echo get_post_meta($post->ID, 'sottotitolo_archalp', true); ?>
       	</header><!-- .entry-header -->
   
       	<?php
       		$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
       		$args = array( 'category_name' => 'archalp', 'posts_per_page' => 8, 'orderby' => 'numero_della_rivista', 'order' => 'DESC', 'paged' => $paged );
       		$loop = new WP_Query( $args );
   
       		the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentytwelve' ) );
   
       		echo '<br /><br /><br />';
   
       		?>
       		<div class="elenco_archalp"><ul>
       			<?php while($loop->have_posts()) : $loop->the_post(); ?>
   
       			<li>
       			<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
       			<a href="<?php the_permalink(); ?>" />
       				<h1>
       					<?php the_date( 'm,Y', the_title() . ' n.' . get_field('numero_della_rivista', $loop->ID) .' - ', '', TRUE ); ?>
       				</h1>
   
       				<?php the_post_thumbnail('archalp-thumb'); ?>
   
       			</a></div></li>
       	<?php 	endwhile;
       				echo paginate_links( array(
       					'total' => $loop->max_num_pages,
       					'mid_size' => 2
       				 ));
       	?>
       	</ul></div>
   
       <?php wp_reset_postdata(); // reset the query ?>
       <?php endif; // is_single() ?>
       ```
   
 * Thnaks in advance!

Viewing 1 replies (of 1 total)

 *  Thread Starter [saburosakai](https://wordpress.org/support/users/saburosakai/)
 * (@saburosakai)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/wrong-loop-output/#post-7301056)
 * Problem solved. I had to define the
    -  height in CSS and I had to modify the date of publication of conflicting 
      posts.

Viewing 1 replies (of 1 total)

The topic ‘Wrong loop output’ is closed to new replies.

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [order](https://wordpress.org/support/topic-tag/order/)
 * [wrong](https://wordpress.org/support/topic-tag/wrong/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [saburosakai](https://wordpress.org/support/users/saburosakai/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/wrong-loop-output/#post-7301056)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
