I’m trying to add a button to my site which links to the next page of posts. I’m looking for a way to add an HTML link to the button so it actually works.
http://codex.wordpress.org/Template_Tags/wp_link_pages
I believe that explains what I want, but I’m not having any luck trying to get those snippets to work.
My button looks like:
<a href="#" class="next_page">Next Page</a>
How can I link the button to the next page function in WordPress?
EDIT:
My problem is I can’t figure out how to associate this code with a button.
There are two ‘built-in’ ways of doing this in WordPress:
1) If you need access to the link as a PHP variable, try Using get_next_posts_link
From here the links are stored in variables and you can do whatever you’d like with them.
2) Otherwise use these:
Where $label is the name of the link ( “Next Page” in your case ) and $max_pages is the max number of pages (if you want a limit), that the link shows up on.
If you want to style these, without having to enclose them inside another DIV, use WordPress Filters
3) If you need even more control you can try this, from the source code for the above functions:
Also, I would suggest asking these types of questions over at wordpress.stackexchange.com