Last active
December 3, 2019 07:10
-
-
Save topleague/74eef1c69a8cf968002db0e60c2e0ef6 to your computer and use it in GitHub Desktop.
Previous/Next Post in Genesis (Featured Image)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ADD NEXT/PREV POST + Add Featured Images To Previous & Next Post Nav Links | |
add_action('genesis_after_entry', 'wpsites_image_nav_links', 9 ); | |
/** | |
* @author Brad Dalton | |
* @link http://wpsites.net/web-design/add-featured-images-to-previous-next-post-nav-links/ | |
* //https://crunchify.com/how-to-display-last-updated-on-datetime-of-your-wordpress-blog-post-genesis-framework-hook-included/ | |
//https://stackoverflow.com/questions/7563568/display-post-date-on-previous-next-link | |
// https://sridharkatakam.com/add-links-previous-post-next-post-single-posts-genesis/ | |
*/ | |
function wpsites_image_nav_links() { | |
if( !is_singular('post') ) | |
return; | |
if( $prev_post = get_previous_post() ): | |
echo'<span class="single-post-nav previous-post-link">'; | |
$prevpost = get_the_post_thumbnail( $prev_post->ID, 'medium', array('class' => 'pagination-previous')); | |
// previous_post_link( '%link',"$prevpost <p>← Previous Post</p>", TRUE ); | |
previous_post_link( '%link',"$prevpost" ); | |
previous_post_link( '%link', '« Previous Post: %title' ); | |
echo'</span>'; | |
endif; | |
if( $next_post = get_next_post() ): | |
echo'<span class="single-post-nav next-post-link">'; | |
$nextpost = get_the_post_thumbnail( $next_post->ID, 'medium', array('class' => 'pagination-next')); | |
//next_post_link( '%link',"$nextpost <p>Next Post →</p>", TRUE ); | |
next_post_link( '%link',"$nextpost" ); | |
next_post_link( '%link', 'Next Post: %title »' ); | |
echo'</span>'; | |
endif; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment