• Resolved befranga

    (@befranga)


    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)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘post query problem (first three posts different layout)’ is closed to new replies.