This topic is: not resolved
- This topic has 0 replies, 1 voice, and was last updated 1 year, 10 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.
Community Forums › Forums › General Genesis Framework Discussions › CPT single post navigation in alphabetical order
Tagged: alphabetical, CPT, single post navigation
I have a custom post type of 'encyclopedia' and I want to add single post navigation in alphabetical order. The default is, of course, in the chronological order of the 'encyclopedia' entries were added. I am using this code in my functions.php to add single post navigation for my regular posts and the encyclopedia CPT. Can anyone tell me what I need to do to get the single post navigation to run in alphabetical order for my CPT?
//ADD SINGLE POST NAVIGATION
add_action( 'genesis_entry_footer', 'single_post_adjacent_entry_nav_genesis' );
function single_post_adjacent_entry_nav_genesis() {
if ( ! is_singular( array( 'encyclopedia', 'post' ) ) ) {
return;
}
genesis_markup( array(
'open' => '<div %s>',
'context' => 'adjacent-entry-pagination',
) );
echo '<div class="pagination-previous alignleft">';
previous_post_link( '%link', '◄ %title' );
echo '</div>';
echo '<div class="pagination-next alignright">';
next_post_link( '%link', '%title ►' );
echo '</div>';
genesis_markup( array(
'close' => '</div>',
'context' => 'adjacent-entry-pagination',
) );
}
You can see my test site at: https://graphicviolence.co.uk/demo/
https://graphicviolence.co.uk/demo/© 2024 WPEngine, Inc.