• Hi,

    I am using a custom theme that someone has made for my website, but I am modifying it as some features weren’t included in the site like pagination. I am having an issue with pagination and the archives feature.

    The pagination buttons at the bottom of the page don’t link to the next page of posts, instead the same posts appear. I think it’s a problem with the WordPress query and I have tried a number of different things to fix it including adding &paged=$paged (though I might have done this wrong). The home page features posts just from one category.

    Also, my archives don’t link to the correct posts either, instead a ‘Page not Found’ appears in the page title.

    Please help! I am a student learning WordPress and I asked my tutor and she didn’t know what to do. I am using WordPress version 3.9.2. The website I am working on it http://www.izemagazine.com

    My code is as below:

    <?php get_header(); ?>
    
        <div class="container">
    
            <?php wp_nav_menu( array( 'theme_location' => 'resp-tag-menu' ) ); ?>
    
            <ul class="filter">
                <li>FILTER+</li>
                <li><?php wp_nav_menu( array(   'theme_location' => 'tag-menu',
                                                'container' => false,
                                            ) ); ?></li>
            </ul>
    
            <div class="homeside"><?php dynamic_sidebar( 'sidebar-home'); ?></div>
    
            <?php
            if (is_home()) {
            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
            query_posts($query_string . 'cat=13&paged=$paged');
            }
            $queryObject = new WP_Query( 'cat=13' );
            // The Loop!
            if ($queryObject->have_posts()) {
                ?>
    
                <?php
                while ($queryObject->have_posts()) {
                    $queryObject->the_post();
                    ?>
    
            <div class="articles">
                <?php if ( has_post_thumbnail()) : ?>
                <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
             <?php the_post_thumbnail(); ?>
    
                <h3><?php the_title(); ?></h3>
                <p><?php the_excerpt(); ?></p>
    
                <p class="readmore">READ MORE</p>
    
                </a>
                <?php endif; ?>
    
            </div>
    
            <?php
                }
            ?>
    
            <?php
                }
            ?>
    
            <div id="pagination">
            <span class="nav-previous"><?php next_posts_link( 'Older Posts', $post->max_num_pages ); ?></span>
            <span class="nav-next"><?php previous_posts_link( 'Newer Posts', $post->max_num_pages ); ?></span>
            </div>
    
        </div>
    
    <?php get_footer(); ?>
  • The topic ‘Issue with Pagination & Archiving on Home Page’ is closed to new replies.