Forum Replies Created

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

    (@jongarzamx)

    Everything is super clear!!!

    Thank you so much for your quick response, It works perfectly

    Thread Starter Jon Garza

    (@jongarzamx)

    This is probably not the right way to do it, but using ‘offset’ => 1 fix the problem for now.

    <article class="post" id="postmedium">
    <?php query_posts( array(
    	'category_name' => 'category1',
    	'posts_per_page' => 1,
    	'post__not_in' => $do_not_duplicate,
    	'offset' => 1
        )
    );
    while ( have_posts() ) : the_post();?>
    <!--Do Stuff-->
    <?php endwhile; ?>

    If somebody knows a better way, please let me know

    Thread Starter Jon Garza

    (@jongarzamx)

    Here’s my code, what am I doing wrong???

    <?php $do_not_duplicate = array();
    query_posts('category_name=category1&posts_per_page=1');
    while ( have_posts() ) : the_post();
    $do_not_duplicate = $post->ID; ?>
    <!--Do Stuff-->
    <?php endwhile; ?>
    
    <?php $do_not_duplicate = array();
    query_posts('category_name=category2&posts_per_page=1');
    while ( have_posts() ) : the_post();
    $do_not_duplicate[] = $post->ID; ?>
    <!--Do Stuff-->
    <?php endwhile; ?>
    
    <article class="post" id="postmedium">
    <?php query_posts( array(
        'category_name' => 'category1',
    	'posts_per_page' => 1,
        'post__not_in' => $do_not_duplicate
        )
    );
    while ( have_posts() ) : the_post();?>
    <!--Do Stuff-->
    <?php endwhile; ?>
    
    <?php query_posts( array(
        'category_name' => 'category2',
    	'posts_per_page' => 1,
        'post__not_in' => $do_not_duplicate
        )
    );
    while ( have_posts() ) : the_post();?>
    <!--Do Stuff-->
    <?php endwhile; ?>

    The “category2” post doesn’t repeat, the problem is with “category2”

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