Skip to content

Instantly share code, notes, and snippets.

@braddalton
Last active April 19, 2021 13:05
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 braddalton/46f43f4aa97a6e612732 to your computer and use it in GitHub Desktop.
Save braddalton/46f43f4aa97a6e612732 to your computer and use it in GitHub Desktop.
Add Previous & Next Image Pagination Links To Image Attachments https://wpsites.net/web-design/add-previous-next-image-pagination-links-to-image-attachments/
add_action ( 'genesis_entry_footer', 'wpsites_attachment_image_navigation' );
function wpsites_attachment_image_navigation() {
if ( wp_attachment_is_image( $post_id ) ) {
echo'<div class="attachment-image-navigation">';
previous_image_link( false, '<div class="previous-image alignleft">' . __( 'View Previous Image', '$text_domain' ) . '</div>' );
next_image_link( false, '<div class="next-image alignright">' . __( 'View Next Image', '$text_domain' ) . '</div>' );
echo'</div>';
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment