Skip to content

Instantly share code, notes, and snippets.

@marklchaves
Last active September 16, 2021 13:41
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 marklchaves/52e184d4749724dad042a95966a37d4a to your computer and use it in GitHub Desktop.
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
/**
* 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