Skip to content

Instantly share code, notes, and snippets.

@neilgee
Created March 21, 2016 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilgee/0d8f266710c0daf7c28a to your computer and use it in GitHub Desktop.
Save neilgee/0d8f266710c0daf7c28a to your computer and use it in GitHub Desktop.
Change Previous and Next Link Text in WP Posts Navigation
<?php
add_action( 'genesis_entry_footer', 'genesis_prev_next_post_nav_cpt' );
/**
* Display links to previous and next post, from a single post.
*
* @since 1.5.1
*
* @return null Return early if not a post.
*/
function genesis_prev_next_post_nav_cpt() {
if ( ! is_singular( array( 'portfolio', 'post' ) ) )//targetting an array here
return;
genesis_markup( array(
'html5' => '<div %s>',
'xhtml' => '<div class="navigation">',
'context' => 'adjacent-entry-pagination',
) );
echo '<div class="pagination-previous alignleft">';
previous_post_link('&laquo; %link', 'Previous Post'); //Change label navigation text to suit
echo '</div>';
echo '<div class="pagination-next alignright">';
next_post_link(' %link', 'Next Post &raquo;'); //Change label navigation text to suit
echo '</div>';
echo '</div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment