Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hey the way i have my index coded is that it shows one full post and the rest of the post are excerpts, but when i click previous the 2nd page shows the same post from the first page, what can i do to change this.

Here is my index.php file

                                                    <?php get_header() ?>

    <div id="content">          
 <?php if (have_posts()) : ?>
 <?php $count = 0; ?>

 <?php 
 query_posts('cat=0'); while(have_posts()) : the_post(); 
 ?>
 <?php $count++; ?>

 <?php if ($count <= 1) : ?>


    <div class="entry-single">
            <div class="entry-top">

                <h2 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf( __('Permalink to %s', 'wpbx'), the_title_attribute('echo=0') ) ?>" rel="bookmark"><?php the_title() ?></a></h2>

                <div class="entry-meta-top">
                    <span class="entry-date"><font color="#e60288"><b><?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?></b></font></span>
                    <span class="entry-meta-sep">|</span>
                    <span class="entry-cat">Published in <?php the_category(','); ?> </span>

            </div>
 <div id="sharing">
 <span class='st_facebook_hcount' st_title='<?php the_title(); ?>' st_url='<?php          the_permalink(); ?>' displayText='share'></span><span class='st_twitter_hcount'     st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>' displayText='share'></span><span class='st_plusone_hcount' st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>' displayText='share'></span></div>
                </div>

            <div class="entry-content clearfix">
                <?php the_content('<p align="right"><b>Read More     »</b></p>') ?>
                <?php wp_link_pages('before=<div class="page-  link">' . __( 'Pages:', 'wpbx' ) . '&after=</div>') ?>
            </div>

               <div class="entry-meta entry-bottom">
  <?php the_tags( __( '<span class="tag-links">More On: ', 'wpbx' ), ", ", "</span>\n" ) ?>

        <div id="footshare"><span class='st_facebook_hcount' st_title='<?php      the_title(); ?>' st_url='<?php the_permalink(); ?>' displayText='share'></span><span class='st_twitter_hcount' st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>' displayText='share'></span><span class='st_plusone_hcount' st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>' displayText='share'></span></div>

 <div id="footcomm"><span class="entry-comm"><?php comments_popup_link( __( 'Leave A Comment', 'wpbx' ), __( '1 Reaction', 'wpbx' ), __( '% Reactions', 'wpbx' ) ) ?></span></div>

            </div>

 <?php else : ?>


 <div class="entry">
        <div class="entry-top">



        </div>

            <div class="entry-content clearfix">

                <div class= "entry-list-thumb">
                    <a href="<?php the_permalink(); ?>" title="    <?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>">
                    <?php the_post_thumbnail(); ?>
                    </a>
                </div>

                <div class="entry-content">

 <h2 class="entry-title2"><a href="<?php the_permalink() ?>" title="<?php printf( __('Permalink to %s', 'wpbx'), the_title_attribute('echo=0') ) ?>" rel="bookmark"><?php the_title() ?></a></h2>

 <div class="entry-meta-top">
                <span class="entry-date"><font color="#89f800"><b>     <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?></b></font></span>
                <span class="entry-meta-sep">|</span>
                <span class="entry-comm">Published in <?php the_category(', '); ?></span>
            </div>

        <?php the_excerpt(); ?>



                </div>

            </div>



 <div class="entry-meta entry-bottom2">

<div id="footshare2"><a href="http://twitter.com/home?status=<?php the_title(); ?> http://celebloid.com/?p=<?php the_ID(); ?>" title="Share This Article On Twitter!" target="_blank"><img src="http://www.celebloid.com/wp-content/uploads/2012/02/twittershare.png"></a> <a href="http://www.facebook.com/sharer.php?u=<?php the_permalink() ?>" title="Share this on Facebook" target="_blank"><img src="http://www.celebloid.com/wp-content/uploads/2012/02/facebookshare.png"></a> <a class="addthis_button_email"><img src="http://www.celebloid.com/wp-content/uploads/2012/02/emailshare.png"></a> <a href="http://addthis.com/bookmark.php?v=250&amp;username=ra-4f481f3e69cf1512" class="addthis_button_compact"><img src="http://www.celebloid.com/wp-content/uploads/2012/02/moreshare.png"></a></div>

 <div id="footshare4"><?php the_tags( __( '<span class="tag-links">More On: ', 'wpbx' ), ", ", "</span>\n" ) ?></div>

 <div id="footcommm"><span class="entry-more"><a href="<?php the_permalink() ?>" title="<?php printf(__('Continue reading %s'), wp_specialchars(get_the_title(), 1)) ?>"><?php _e( '<img src="http://www.celebloid.com/wp-content/uploads/2012/02/readmore.jpg">', 'wpbx' ) ?></a></span></div>

            </div>


 <?php endif; ?>
    </div><!-- .post -->

<?php endwhile; ?>

  <?php else : ?>
 <?php endif; ?>

        <div class="navigation clearfix">
            <div class="nav-previous"><?php next_posts_link(__( 'Previous <span class="meta-nav">Articles</span>', 'wpbx' )) ?></div>
            <div class="nav-next"><?php previous_posts_link(__( 'Next <span class="meta-nav">Articles</span>', 'wpbx' )) ?></div>

        </div>

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

 <?php get_sidebar() ?>
 </div>
 <?php get_footer() ?>

The reason i query my post is because i made a custom featured content slide that only gets post from a certain category.

Without the post being query it only pulls post from the category on the content slide.

share|improve this question

closed as too localized by toscho Jan 2 '13 at 22:59

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

Use this code instead for query post. Parameter 'paged' is which that keep track of the pagination so you have to pass it on query posts.

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
                'cat' => 0,
                'paged' => $paged
                );
query_posts($args);

Also try to avoid query_posts() unless its absolutely necessary. Use get_posts().

share|improve this answer
    
That isn't working for me, it gives me an error saying Parse error: syntax error, unexpected T_ENDWHILE in /hermes/bosweb/web188/b1885/ipg.celebloidcom1/wp-content/themes/celebloid/index.‌​php on line 139 and on that line is <?php endwhile; ?> and when i took that off it only showed the post from the 2nd page on the first page –  Terrell Anderson Mar 3 '12 at 9:40
    
the code suggested by @prionkor has to replace exactly this section query_posts('cat=0'); –  Michael Mar 3 '12 at 9:55
    
I found a solution, after looking for codes and implementing a lot of them, i just added a line to the origial get_post. Here is what i added and now the pages work perfectly :) I'm happy. <?php query_posts( array( 'cat' => -0, 'paged'=> $paged ) ); while(have_posts()) : the_post(); ?> i don't have a higher enough reputation to answer :( –  Terrell Anderson Mar 3 '12 at 10:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.