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.

I'm building a site and the basic structure on most pages is as follows:

<!-- content query -->
<!-- recent posts preview query (paginated) -->
<!-- related posts preview query (paginated) -->

The paginated content is loading on the same page using jQuery, so just that specific section updates when the user navigates to the next page or a section.

Most of my pages are literally pages with custom templates on which I run custom queries (WP_query) for each thing. This works really well on the custom pages, but I am trying to implement it similarly on single.php. The structure I want on single.php is:

<!-- post content -->
<!-- recent posts preview query (paginated) -->
<!-- related posts preview query (paginated) -->

However, my code that works perfectly fine on custom pages has broken pagination on single.php. Researching this, it seems it may be conflicting with the fact that posts themselves can be paginated. I've not been able to find much more info than that.

Does anyone know if it's possible to achieve my goal here? Is there any workaround, in any capacity that would make it happen?

Thank you very much for any insight you might be able to offer!

share|improve this question
    
    
Of course! The trouble is, it's not an issue with paginating custom loops (as I'm successfully paginating these same loops in other places on the site). Rather, it's a question of whether something besides the post (in this case, additional loops) can be paginated in single.php specifically. Thanks for asking! –  Ashe Abbott Mar 14 '12 at 15:06
    
Out of curiosity: does your pagination work on static Pages that are themselves paginated, or only on single-page static Pages? –  Chip Bennett Mar 14 '12 at 15:27
    
I'm afraid I'm not sure what you mean exactly. All my pages are comprised of multiple paginated WP_queries, so I think they are all single-page static Pages? All content is paginated within the Page itself. How would pages that are themselves paginated work, so I am sure I'm understanding? I can test it if I understand properly. Sorry for my lack of understanding! Thanks for replying again! :) –  Ashe Abbott Mar 14 '12 at 15:50
1  
Well, for anyone else looking to solve a similar problem, I found this post, and it led me in the right direction: wordpress.org/support/topic/…; . I added the snippet of code at the bottom to my functions.php, and my code is working now. I don't know enough about it to know what it does, but it seems to fix the problem! Thanks, Chip, for your help! –  Ashe Abbott Mar 14 '12 at 19:11

1 Answer 1

up vote 4 down vote accepted

Well, for anyone else looking to solve a similar problem, I found this post, and it led me in the right direction: http://wordpress.org/support/topic/pagination-on-singlephp-causing-301-redirect?replies=9.

I added this snippet of code to my functions.php, and I can paginate in custom queries without issue on single.php now. I don't know enough about it to know what it does, but it seems to fix the problem!

add_filter('redirect_canonical','pif_disable_redirect_canonical');

function pif_disable_redirect_canonical($redirect_url) {
    if (is_singular('pov_channel')) $redirect_url = false;
return $redirect_url;
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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