Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7595135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:35:50+00:00 2026-05-30T21:35:50+00:00

I try to display my post using two column, to make sure the fit

  • 0

I try to display my post using two column, to make sure the fit each other, I tried to create two vertical column, and display the post odd and even seperately. Odd on left side, and even on the right side. And im suing wp_pagenavi() to get navigation working, other page work fine, display the post as I intend it to be, but on the last page, one post will repeat twice.

Here my code for the looping part

<?php if ( have_posts() ) : ?>

            <?php /* Start the Loop */ ?>
        <div id="holder" class="left">

            <?php while ( have_posts() ) : ?> 
            <?php
                $postcount++;
                if( ($postcount % 2) == 0 ) : // skip 'even' posts 
                $wp_query->next_post(); 
                else :
                ?>

                <?php the_post(); ?>

            <div class="fpost">
                <div class="fposttitle">
                    <h1 class="left"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'toolbox' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
                    <?php if ( comments_open() || ( '0' != get_comments_number() && ! comments_open() ) ) : ?>
                        <div class="combox right">
                            <?php $x = get_comments_number(); if ($x < 10) : ?>
                                <?php comments_popup_link( __( '00', 'toolbox' ), __( '01', 'toolbox' ), __( '0%', 'toolbox' ) ); ?>
                            <?php else : ?>
                                <?php comments_popup_link( __( '00', 'toolbox' ), __( '01', 'toolbox' ), __( '%', 'toolbox' ) ); ?>
                            <?php endif; ?>
                        </div>
                    <?php endif; ?>
                    <div class="clear"></div>
                </div>

                <div class="fcontent">
                    <?php $thumbnail = get_post_meta(get_the_ID(), 'thumbnail', true); 
                    if ($thumbnail) : ?>
                        <img src="<?php echo $thumbnail; ?>" alt="<?php the_permalink(); ?>" />
                    <?php else : ?>
                        <p><?php the_excerpt(); ?></p>
                    <?php endif; ?>
                </div>

                <div class="finfo">
                    <p class="left date"><?php the_time('F j, Y') ?></p>
                    <p class="left cat"><?php the_category(', ') ?></p>
                    <p class="right"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'toolbox' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark" >Read More</a></p>
                    <div class="clear"></div>
                </div>
            </div>

            <?php endif; ?>
            <?php endwhile; ?>

        </div><!-- #content -->

        <div id="holder2" class="left">

            <?php while ( have_posts() ) : ?> 
            <?php
                $postcount++;
                if( ($postcount % 2) != 0 ) : // skip 'odd' posts
                $wp_query->next_post();

                else :
                ?>

                <?php the_post(); ?>

            <div class="fpost">
                <div class="fposttitle">
                    <h1 class="left"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'toolbox' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
                    <?php if ( comments_open() || ( '0' != get_comments_number() && ! comments_open() ) ) : ?>
                        <div class="combox right">
                            <?php $x = get_comments_number(); if ($x < 10) : ?>
                                <?php comments_popup_link( __( '00', 'toolbox' ), __( '01', 'toolbox' ), __( '0%', 'toolbox' ) ); ?>
                            <?php else : ?>
                                <?php comments_popup_link( __( '00', 'toolbox' ), __( '01', 'toolbox' ), __( '%', 'toolbox' ) ); ?>
                            <?php endif; ?>
                        </div>
                    <?php endif; ?>
                    <div class="clear"></div>
                </div>

                <div class="fcontent">
                    <?php $thumbnail = get_post_meta(get_the_ID(), 'thumbnail', true); 
                    if ($thumbnail) : ?>
                        <img src="<?php echo $thumbnail; ?>" alt="<?php the_permalink(); ?>" />
                    <?php else : ?>
                        <p><?php the_excerpt(); ?></p>
                    <?php endif; ?>
                </div>

                <div class="finfo">
                    <p class="left date"><?php the_time('F j, Y') ?></p>
                    <p class="left cat"><?php the_category(', ') ?></p>
                    <p class="right"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'toolbox' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark" >Read More</a></p>
                    <div class="clear"></div>
                </div>
            </div>

            <?php endif; ?>
            <?php endwhile; ?>

        </div><!-- #content -->



        <?php else : ?>

            no post


    <?php endif; ?>

        <div class="clear"></div>
             <div id="nav"> <?php wp_pagenavi() ?> </div>
    </div><!-- #primary -->

I thinking maybe because last page, there is not enough number post, but can’t figure out why the post repeat.

update: I just tried to add one new post, and everything work fine. but when I add another post, it the last page repeat same post again.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:35:52+00:00Added an answer on May 30, 2026 at 9:35 pm

    Probably should have included this as an answer instead of a comment, in the case where you have an odd number of posts, you don’t reset your $postcount variable to 0, so your 2nd loop doesn’t necessarily start on the same condition that the first loop did. So on your last page you’re able to notice this happening, but chances are on the other pages you’re skipping certain posts altogether:

            <?php if ( have_posts() ) : ?>
    
            <?php /* Start the Loop */ ?>
            <div id="holder" class="left">
            <?php $postcount = 0; ?>
            <?php while ( have_posts() ) : ?> 
            <?php
                $postcount++;
                if( ($postcount % 2) == 0 ) : // skip 'even' posts 
                $wp_query->next_post(); 
                else :
                ?>
                <?php the_post(); ?>
            <?php endif; ?>
            <?php endwhile; ?>
            ...
        </div><!-- #content -->
    
        <div id="holder2" class="left">
        <?php $postcount = 0; ?>
            <?php rewind_posts();//rewind the post counter so you can do another loop ?>
            <?php while ( have_posts() ) : ?> 
            <?php
                $postcount++;
                if( ($postcount % 2) != 0 ) : // skip 'odd' posts
                $wp_query->next_post();
    
                else :
                ?>
    
                <?php the_post(); ?>
    
            ...
    
            <?php endif; ?>
            <?php endwhile; ?>
    
        </div><!-- #content -->
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I try to display the contents of a LOB (large object) column in
I am using the following code to try and display in a time in
I have the following issue using java 1.4 I try to display a very
i have a problem,,i try to make a table using datatable...i've been download from
Using nanoc to create a blog archive page, I'd like to display a list
I'm not sure how to display the error messages for my form when using
I am using wordpress and am using featured images(they used to be called post
I'm using jQuery in my ASP.NET MVC 2 page. It's a super simple post
In my Android app, I log in using the Facebook SDK and display posts
I'm using this piece of code I found ( http://impnerd.com/wordpress-hack-add-post-images-to-your-homepage ) to display the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.