14 posts
  • Has been part of the Envato Community for over 2 years
  • Sells items exclusively on Envato Market
ReikiStudios says

My pagination in my blog keeps repeating the first page of content on all pages. How can I fix this? Any help would be greatly appreciated.

Here is the code I have so far:

<?php
/*
Template Name: Blog
*/
get_header(); ?>
    <div id="content_wrap">
        <div id="content">
            <h1><?php the_title(); ?></h1>
            <img src="<?php bloginfo('template_directory');?>/images/content_line.png" border="0" alt="" />
            <div id="blog_wrap">
                <?php
        query_posts( array('post_type' => 'post') ); 
                if ( have_posts() ) :
                    while(have_posts()) : the_post();?>
                    <div class="blog_post">
                        <?php if ( has_post_thumbnail() ) : ?> 
                        <div class="blog_post_img">
                            <?php the_post_thumbnail('post-thumb'); ?>
                        </div>
                        <?php endif; ?>
                        <div class="blog_post_text" if="" :="">style="width: 640px;"<?php endif; ?>><h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3><?php the_excerpt(); ?></div>
                        <div class="clear" />
                        <div class="post_details">
                            <ul>
                                <li class="posted_by"><?php _e('Posted By','Static Strings');?> <?php the_author_posts_link(); ?></li>
                                <li class="date"><?php echo get_the_date('F jS, Y'); ?></li>
                                <li class="post_comment"><?php 
                                   $comments_count = wp_count_comments($post->ID); 
                                   $comment_count = $comments_count->approved;                                 
                                   if($comment_count != 0): ?>
                                        <a href="<?php the_permalink();?>"> 
                                            <?php echo $comment_count; ?> 
                                        </a>
                                        <?php    
                                        if($comment_count == 1): echo " Comment";
                                        elseif($comment_count > 1): echo " Comments";
                                        endif;
                                   else:
                                        echo " No Comments";
                                   endif;       
                                   ?>
                                </li>
                                <li class="read_more">
                                    <a href="<?php the_permalink();?>"><?php _e('Read more','Static Strings'); ?></a>
                                </li>
                            </ul>
                        </div>
                        <img src="<?php bloginfo('template_directory');?>/images/cont_line.png" border="0" alt="" />
                    </div> 
                <?php
                endwhile;
                else: ?>
                     <p><?php _e('In this category no posts.'); ?></p>
                <?php
                endif;

                ?> 
                <div class="navigation" style="margin-bottom:25px;"><?php posts_nav_link(); ?></div>  

            </div>
        </div>
        <?php get_sidebar(); ?>
        <?php wp_reset_query(); ?>  
        <div class="clear" />
    </div>
<?php get_footer(); ?>    

 
709 posts
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+2 more
ChillThemes says

Try changing this:

query_posts( array('post_type' => 'post') );

to

query_posts( array( 'post_type' => 'post', 'paged' => $paged ) );
221 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+2 more
NuclearThemes says
Like itsmattadams said although you may also need to add
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
above it.
14 posts
  • Has been part of the Envato Community for over 2 years
  • Sells items exclusively on Envato Market
ReikiStudios says

Thanks a bunch I made the edits and it works perfectly! You guys are awesome!

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by