Last active
September 16, 2021 13:41
-
-
Save marklchaves/52e184d4749724dad042a95966a37d4a to your computer and use it in GitHub Desktop.
Custom Pagination Links for Avada Blog Posts - Display Blog Post Titles Instead of the Boring Previous and Next
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
/** | |
* Custom Pagination Links for Avada Blog Posts | |
* | |
* Instead of displaying Previous and Next, display the blog post | |
* titles. | |
* | |
* Replace the pagination code in your child theme’s single.php with this. | |
*/ | |
<?php | |
$previous = get_previous_post(); | |
$next = get_next_post(); | |
?> | |
<?php | |
if ( $previous ) { | |
previous_post_link( '%link', esc_attr__( get_the_title( $previous ), 'Avada' )); | |
} else { | |
previous_post_link( '%link', esc_attr__( 'Previous', 'Avada' ) ); | |
} | |
?> | |
<?php | |
if ( $next ) { | |
next_post_link( '%link', esc_attr__( get_the_title( $next ), 'Avada' )); | |
} else { | |
next_post_link( '%link', esc_attr__( 'Next', 'Avada' ) ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment