Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Andris

    (@andrisibl)

    Just to let you guys know:

    I resolved my problem with another solution. I like to call it the ?do_not_duplicate?-method.

    Here’s my first query:

    <?php if (have_posts()) : ?>
    <?php $header_query = new WP_Query( array('post_type' => 'post', 'post__not_in' => $do_not_duplicate, 'orderby' => 'date', 'order' => 'DESC', 'showposts' => '1' ) ); ?>
    <?php while ( $header_query->have_posts() ) : $header_query->the_post(); 
    	$do_not_duplicate[] = $post->ID;
    ?>
    
    <!-- Enter Stuff here -->	
    
    <?php endwhile; endif; ?>
    
    <?php wp_reset_query(); ?>

    And here’s the second query:

    <?php if (have_posts()) : ?>
    	<?php $list_query = new WP_Query( array('post_type' => 'post', 'post__not_in' => $do_not_duplicate, 'orderby' => 'date', 'order' => 'DESC', 'paged' => $paged ) ); ?>
    	<?php while ( $list_query->have_posts() ) : $list_query->the_post(); 
    		$do_not_duplicate[] = $post->ID;
    	?>
    	     	
    <!-- Enter some other Stuff here -->
    	
    	<?php endwhile; ?>
    			
    	<div class="page-navigation">
    	<?php posts_nav_link(); ?>		
    	</div><!-- end page-navigation -->
    	
    	</div><!-- end teaserposts -->
    		
    <?php endif;?>	
    
    <?php wp_reset_query(); ?>

    That totally did the trick for me. Hope it helps, if anyone else has the same problem.

    Cheers.

    Thread Starter Andris

    (@andrisibl)

    I finally made it almost work.

    I’m just not sure how I can assign this workaround to the specific query.

    There are two queries. One for the first post, which is dispplay differently than the others and one for the rest. I just don’t wanna display the first post again in the second query. So the workaround assigns the function to the is_home() query.

    if ( ! $query->is_home() ) {
            return;
        }

    What if I wanna have this function only on my $list_query, which looks like this, right now:

    <?php $list_query = new WP_Query( array('post_type' => 'post', 'orderby' => 'date', 'order' => 'DESC', 'paged' => $paged) ); ?>
    	<?php while ( $list_query->have_posts() ) : $list_query->the_post(); ?>
    	     	
            <div class="teaserpost">
                
                <div class="teaser-bild">
                	<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('quadrat'); ?></a>
                </div><!-- end teaser-bild -->
                  
                <div class="teaser-text">
    	            <h3><?php the_time( get_option( 'date_format' ) ); ?></h3>
    	            <h3 class="kategorien"><?php the_category(' | '); ?></h3>
    	            <div class="clear"></div>
                    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                    <?php the_excerpt(); ?>
                </div><!-- end teaser-text -->
                
                <div class="clear"></div>
                
            </div><!-- end teaserpost -->
    	
    	<?php endwhile; ?>
    
    Thread Starter Andris

    (@andrisibl)

    Thanx @bcworkz for your reply.

    I tried to follow your suggestion but couldn’t make it work. I also tried to make the pagination work without the offset, but couldn’t make it work, too. So maybe it’s not the offset that breaks the pagination but something else or a combination of both.

    The category page also shows the same entries on page 2. Where I don’t use the offset parameter:

    <?php if (have_posts()) : 
    		query_posts(array('category_name' => single_cat_title( '', false ))); ?>
    		<?php while (have_posts()) : the_post(); ?>
    	     	
                <div class="teaserpost">
                
                  <div class="teaser-bild">
                  	<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('quadrat'); ?></a>
                  </div><!-- end teaser-bild -->
    			  
                  
                  <div class="teaser-text">
    	              <h3><?php the_date(); ?></h3>
    	              <h3 class="kategorien"><?php the_category(' | '); ?></h3>
                      <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                      <?php the_excerpt(); ?>
                  </div><!-- end teaser-text -->
                
                  <div class="clear"></div>
                
                </div><!-- end teaserpost -->
            
    	<?php endwhile; ?>
    	
    		<?php posts_nav_link(); ?>	
     	
    	<?php endif;?>
        <?php wp_reset_query(); ?>
    

    I’m lost.

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