I have a custom post type for a Slideshow which uses Custom Post Meta to insert the different slides. How can I code the <!--nextpage--> tag in between the sides in my slideshow.php so that they slides will paginate? Right now when I try to do it the code doesn't show because it by it's nature it commented out.

3 Answers 3


This question was more extensively discussed at Hybrid support forum. I made and posted snippet for custom pagination of custom fields content there.


Inserting into your theme does not make much sense, because it's parsed prior theme display. You need to have that in your posts content prior to display (that means in $post->post_content when queried). This might not already be the case, so a reason why you currently experience that it is not paginating. The other reason why this happens is an incompatible theme.

The function that takes care about pagination in post templates (templates are a theme related part in wordpress) is called wp_link_pages(). You theme must support the multipage global variables otherwise this will never work. Those global variables are: $page, $pages, $multipage, $more, $numpages. You can learn more about their usage in setup_postdata() (undocumented function, see setup_postdata() in source).

So if you manage to get all the <!--nextpage--> fragments into your posts content and your theme supports multi pages for that custom post type template, you should be fine. The wp_link_pages() function might be handy to achieve this.

  • My theme supports it so that is not an issue. I'm using custom post meta fields for the post content so technically, I"m not actually using the_content. I guess what I'm asking then if I can't utilize <!--nextpage--> inside my theme files, how can I hard code a page break into a theme?
    – matt
    Sep 5, 2010 at 18:40
  • If you don't use the_content / $post->post_content then you're left alone on your own and maybe the best thing you could do w/o coding a whole paging business logic on your style of having content managed is to call wp_link_pages() on your own. And/Or to reuse the global variables I named.
    – hakre
    Sep 6, 2010 at 21:44

for me <!-- nextpage --> is not working for any theme. Check the post http://article-stack.com/education/web-design-n-development/blog-blogger-blogging/xampp-how-to-run-test-wordpress-locally.amty

  • Please create separate question for your issue, this is neither answer or relevant information for this question.
    – Rarst
    Sep 25, 2010 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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