Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are two 'built-in' ways of doing this in Wordpress:</p> <p>1) If you need access to the link as a PHP variable, try Using <a href="http://codex.wordpress.org/Function_Reference/get_next_posts_link" rel="nofollow">get_next_posts_link</a></p> <pre><code>&lt;?php $nextLink = get_next_posts_link( $label , $max_pages ); ?&gt; &lt;?php $previousLink = get_previous_posts_link( $label ); ?&gt; </code></pre> <p>From here the links are stored in variables and you can do whatever you'd like with them.</p> <p>2) Otherwise use these:</p> <pre><code>&lt;?php next_posts_link( $label , $max_pages ); ?&gt; &lt;?php previous_posts_link( $label ); ?&gt; </code></pre> <p>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.</p> <p>If you want to style these, without having to enclose them inside another DIV, use <a href="http://codex.wordpress.org/Plugin_API/Filter_Reference" rel="nofollow">Wordpress Filters</a></p> <pre><code>function apply_my_next_link_style ( ){ return 'class="button"'; } apply_filters( 'next_posts_link_attributes', 'apply_my_next_link_style' ) </code></pre> <p>3) If you need even more control you can try this, from the <a href="http://core.trac.wordpress.org/browser/tags/3.4.2/wp-includes/link-template.php#L0" rel="nofollow">source code</a> for the above functions:</p> <pre><code>if ( !is_single() ) { echo '&lt;a href="' . next_posts( 0, false ) . "\" $attr&gt;" . preg_replace('/&amp;([^#])(?![a-z]{1,8};)/i', '&amp;#038;$1', "Next Page") . '&lt;/a&gt;'; } </code></pre> <p>Also, I would suggest asking these types of questions over at <a href="http://wordpress.stackexchange.com">wordpress.stackexchange.com</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload