WordPress.org

Ready to get started?Download WordPress

Forums

Another Pagination Problem (5 posts)

  1. thegrrraue
    Member
    Posted 1 year ago #

    Ok, so I've seen a LOT of pagination problems, but haven't been able to find a problem exactly like mine or a solution that I was able to get to work.

    On my page, http://www.somewherenovel.com, the "older posts" and "newer posts" links don't work. What I've found is that they link to ".../page/2" ".../page/3" etc, and none of these seem to work with the theme I'm using (Portfolio Press).

    What does work, however, is if I edit the URL to be ".../?paged=2" and so on. The easy fix seems to be to reformat the variable that creates that link, but I cannot figure out for the life of me how to do that.

    I'm sorry, I'm dumb. Open to other suggestions too.

  2. Hristo SiteGround
    Member
    Posted 1 year ago #

    The most common reason for such issues is the usage of query_posts to filter some of the content you render on the index page.

    If that's the case, make sure you attach the existing query string to the new ones you're using. For example, if you're excluding a category, you should do it like that:

    $posts = query_posts($query_string . '&cat=-3');

  3. thegrrraue
    Member
    Posted 1 year ago #

    Hmm, not filtering anything. If I'm not mistaken, the section of code that needs to be altered is here under theme functions:

    function portfoliopress_content_nav() {
    	global $wp_query;
    	if (  $wp_query->max_num_pages > 1 ) :
    		if (function_exists('wp_pagenavi') ) {
    			wp_pagenavi();
    		} else { ?>
            	<nav id="nav-below">
    			<h1 class="screen-reader-text"><?php _e( 'Post navigation', 'portfoliopress' ); ?></h1>
    			<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'portfoliopress' ) ); ?></div>
    			<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'portfoliopress' ) ); ?></div>
    			</nav><!-- #nav-below -->
        	<?php }
    	endif;
    }

    That's the only place I can seem to find it calling for next and previous posts, but I can't figure out what to do with that to fix it.

  4. thegrrraue
    Member
    Posted 1 year ago #

    I'm still stuck on this. I tried a few other solutions to similar problems, but nothing seemed to work.

  5. gidd
    Member
    Posted 1 year ago #

    Hello thegrrrague. Working with pagination on the homepage is a bit tricky because showing posts on home page is considered a custom loop. Thus, you need to deal with pagination by yourself.

    You can read my previous thread about this problem:
    http://wordpress.org/support/topic/how-to-get-previous-page-it-doesnt-exist

    And don't forget to checkout this url to deal with custom pagination:
    http://weblogtoolscollection.com/archives/2008/04/19/paging-and-custom-wordpress-loops/

Topic Closed

This topic has been closed to new replies.

About this Topic