Skip to content

Instantly share code, notes, and snippets.

@neilgee
Last active November 12, 2016 06:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilgee/43fdae964113c7e062e8 to your computer and use it in GitHub Desktop.
Save neilgee/43fdae964113c7e062e8 to your computer and use it in GitHub Desktop.
Genesis CPT Navigation Links
<?php //<~ dont add me in
add_action( 'genesis_entry_footer', 'wpb_prev_next_post_nav_cpt' );
function wpb_prev_next_post_nav_cpt() {
if ( ! is_singular( 'portfolio' ) ) //add your CPT name
return;
genesis_markup( array(
'html5' => '<div %s>',
'xhtml' => '<div class="navigation">',
'context' => 'adjacent-entry-pagination',
) );
echo '<div class="pagination-previous alignleft">';
previous_post_link();
echo '</div>';
echo '<div class="pagination-next alignright">';
next_post_link();
echo '</div>';
echo '</div>';
}
<?php //<~ dont add me in
add_action( 'genesis_entry_footer', 'wpb_prev_next_post_nav_cpt' );
function wpb_prev_next_post_nav_cpt() {
if ( ! is_singular( array( 'portfolio', 'post' ) ) ) //add your CPT name to the array
return;
genesis_markup( array(
'html5' => '<div %s>',
'xhtml' => '<div class="navigation">',
'context' => 'adjacent-entry-pagination',
) );
echo '<div class="pagination-previous alignleft">';
previous_post_link();
echo '</div>';
echo '<div class="pagination-next alignright">';
next_post_link();
echo '</div>';
echo '</div>';
}
<?php //<~ dont add me in
add_action( 'genesis_entry_footer', 'wpb_prev_next_post_nav_cpt' );
function wpb_prev_next_post_nav_cpt() {
if ( ! is_singular( array( 'portfolio', 'post' ) ) ) //add your CPT name to the array
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 nav text here
echo '</div>';
echo '<div class="pagination-next alignright">';
next_post_link(' %link &raquo;', 'Next Post'); // Change nav text here
echo '</div>';
echo '</div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment