Title: post query problem (first three posts different layout)
Last modified: August 21, 2016

---

# post query problem (first three posts different layout)

 *  Resolved [befranga](https://wordpress.org/support/users/befranga/)
 * (@befranga)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/post-query-problem-first-three-posts-different-layout/)
 * Maybe someone can help me. For my blog page I want the first three articles to
   have a different layout and ALL following look equally.
 * This is how I made it:
 *     ```
       <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
   
                <?php //query_posts($query_string . '&cat=-17'); ?>
                <?php //query_posts(array('category__not_in' => array(17))); ?>
                <?php $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
   
       $args = array(
       	'posts_per_page' => 5,
       	'category__not_in' => array( 17 ),
       	'paged' => $paged,
       );
   
       $the_query = new WP_Query( $args );
       ?>
       			<?php if (have_posts()) : ?>
       			<?php $count = 0; ?>
       			<?php while (have_posts()) : the_post(); ?>
       			<?php $count++; ?>
   
       			<?php if ($count <= 3) : /* First three featured.*/ ?>      
   
       				<?php
       								/* Include the Post-Format-specific template for the content.
       								 */
       								get_template_part('startentry', get_post_format());
       							?>
   
       <!-- End featured. -->
   
       		<?php else : ?>
   
       					<?php
       								/* all other articles
       								 */
       								get_template_part('entry', get_post_format());
       							?>
   
       			<?php endif; ?>
   
       <?php endwhile; ?>
       			<?php endif; ?>
   
       <!-- End other. -->
       <nav id="pagenav"><?php
       $big = 999999999; // need an unlikely integer
   
       echo paginate_links( array(
       	'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
       	'format' => '?paged=%#%',
       	'current' => max( 1, get_query_var('paged') ),
       	'total' => $the_query->max_num_pages
       ) );
       ?>
       </nav>
       </article><!-- #post-## -->
       ```
   
 * Also I have the pagination function. But now I have the problem that every page
   has this layout with the first three posts in different style? And also excluding
   the category doesen’t work.
 * Maybe someone can help me?

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/post-query-problem-first-three-posts-different-layout/#post-4609560)
 * > pagination function. …. every page has this layout with the first three posts
   > in different style
 * integrate the conditional tag `is_paged()` [http://codex.wordpress.org/Function_Reference/is_paged](http://codex.wordpress.org/Function_Reference/is_paged)
 * > excluding the category doesen’t work
 * review [http://codex.wordpress.org/Class_Reference/WP_Query#Usage](http://codex.wordpress.org/Class_Reference/WP_Query#Usage)
 *  Thread Starter [befranga](https://wordpress.org/support/users/befranga/)
 * (@befranga)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/post-query-problem-first-three-posts-different-layout/#post-4609566)
 * Thank you very much for your quick answer. Would you mind given me an example
   where to put it?
 *     ```
       <?php if ($count <= 3) :
       			elseif ( $paged === false ) : /* First three featured.*/ ?>
       ```
   
 * Is not working. Guess I put it wrong
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/post-query-problem-first-three-posts-different-layout/#post-4609572)
 * `if ( $count <= 3 && !is_paged() )`
 *  Thread Starter [befranga](https://wordpress.org/support/users/befranga/)
 * (@befranga)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/post-query-problem-first-three-posts-different-layout/#post-4609579)
 * Thank you so much! Worked great!
 *  Thread Starter [befranga](https://wordpress.org/support/users/befranga/)
 * (@befranga)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/post-query-problem-first-three-posts-different-layout/#post-4609622)
 * Problem solved

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

The topic ‘post query problem (first three posts different layout)’ is closed to
new replies.

## Tags

 * [homepage](https://wordpress.org/support/topic-tag/homepage/)
 * [query](https://wordpress.org/support/topic-tag/query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [befranga](https://wordpress.org/support/users/befranga/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/post-query-problem-first-three-posts-different-layout/#post-4609622)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
