• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Add Previous & Next Image Pagination Links To Image Attachments

If you insert multiple images into a single post, you might want to add pagination so your readers can click thru each image.

The PHP code in this tutorial can be added to the end of your child themes functions.php file to create next and previous image links on image attachment pages only.

attachment settings

When you insert your images, you will need to set the attachment page settings for each image.

Change the genesis_entry_footer hook to loop_start, loop_end or any theme specific action hook if not using Genesis.

For translation, swap out the $text_domain in the code with your themes text domain.

Other Options

Alternatively, you could hard code the links in your image.php or attachment.php file directly using this code.

Note: Your images need to be uploaded and attached to a single post using the attachment page settings for the pagination links to work.

Related Tutorials

  • Add Pagination to WordPress Gallery Image Attachments In Genesis

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.