You may install this plugin and then for the next link, use:
<?php c2c_next_or_loop_post_link('%link','<img src="https://wordpress.stackexchange.com/questions/259353/img-location"/>'); ?>
and for the previous link use:
<?php c2c_previous_or_loop_post_link('%link','<img src="https://wordpress.stackexchange.com/questions/259353/img-location"/>'); ?>
That’s it. Now the previous link of your first post should be the last post and the next link of your last post should be the first post.
If you don’t want to install any plugin, then you may follow the instructions from this post to see how it can be done with custom CODE.
Related Posts:
- Can’t get the previous and next posts permalink
- next_posts_link not working in custom loop
- Next Posts Prev Posts for Standard post format only
- How to exclude or filter password protected posts when using next_post_link() previous_post_link
- How to filter get previous post function by meta value DESC and post date DESC?
- Multiple loops using next_posts_link & previous_posts_link
- How can I limit the length of the previous/next posts in my WordPress Theme?
- Problem excluding category from get_next_post
- specify meta_key / meta_value condition for prev_post_link and next_post_link
- Is it possible to nest get_previous_post()?
- Why do next pages load the same content rather then older articles?
- previous/next_post_link in the same sub-category?
- get_adjacent_post – in same term or category not working
- next_post_link / previous_post_link not working with WP_Query
- Pagination for custom loop on custom page template is not displaying anything
- Next/Previous links doesn’t work in the same category
- How do I display a greyed out next_post_link when there is no next post
- Page Navigation Outside the Loop
- Include “Scheduled” (“Future”) Posts in WordPress Post Navigation ( previous_post_link, next_post_link ) for a Specific Custom Post Type
- How to get next post link of child custom post type from parent post and get next post link of parent post from the last child post?
- How to exclude posts by meta key value in the_post_navigation next prev links?
- Prev/Next Navigation on Single Post Disappeared for Custom Post Type
- Change URL of previous posts and next posts link in WordPress
- Dynamic next and previous post links
- Post in multiple categories do not include in previous / next post if one category in excluded
- Previous Posts Link and Next Posts Link Show All The Same Articles?
- posts_nav_link() not working on index.php
- Previous / next posts using featured image thumbnail as links
- How to fix pagination for custom loops?
- Jquery Slider for profile template
- Counting the posts of a custom WordPress loop (WP_Query)?
- Can the Next/Prev Post links be ordered by menu order or by a meta key?
- if ( is_home() && ! is_front_page() )
- Get excerpt using get_the_excerpt outside a loop
- How to display Yoast SEO meta description in archive template for each post instead of the_excerpt()? [closed]
- Get post content from outside the loop
- Why should I put if(have_posts()), is while(have_posts()) not enough?
- Display featured products through custom loop in woocommerce on template page
- Split Content and Gallery
- Get the children of the parent category
- How to get Author ID outside the loop
- How can i display the content in plaintext
- Redirect loop when trying to login to /wp-admin/ [duplicate]
- How to split a loop into multiple columns
- Is it necessary to reset the query after using get_posts()?
- is it possible to get next_post_link
- Is there any difference between the_title() and echo get_the_title()?
- AJAX with loop filtering categories
- Get Previous & Next posts by Post ID
- Do I need to use The Loop on pages?
- Remove the Homepage Query
- Filter next_post_link() and previous_post_link() by meta_key?
- remove tags from the_content
- WP_Query and next_posts_link
- the_title() shows title of the first post instead of the page title?
- How to force excerpts / teasers in the loop
- Retrieve each widget separately from a sidebar
- How can I add title attributes to next and previous post link functions?
- Why am I being limited to ten posts on a custom loop?
- How to Get Next or Previous Post in a Specific Tag?
- Should I use loop in the single.php file?
- A search for ‘0’ returns results
- Why do themes rely on “The Loop”?
- How to return loop contents
- Using the Loop to show all levels of subpages under a parent page? Halfway there
- How to get next and previous post links, alphabetically by title, across post types, in a shortcode
- Cleanest Way to Select Every Second Element in a Loop?
- get_adjacent_post alternative on a very large db
- Insert image or ad script after 3 posts using the loop
- Get date of last update outside of loop
- Pagination not working on home page
- Child Pages Loop
- How to place comments_template(); outside the loop?
- Prev/Next child navigation for current page?
- Multiple Loops Homepage?
- How to Change Loop to Order Posts by Views (using wp-postviews plugin)
- how to upload image using wp_handle_upload
- How can I get next/ previous post links to order by a filter (by the last word of the title)?
- Avoiding using a loop to access a single post
- How to get the first image gallery of a product in woocommerce in a loop
- next and previous post link ordered alphabetically
- Get post by page name or slug
- save_post + insert_post = infinite loop
- Thumbnail (featured image) of next and previous post is not being properly displayed!
- Loop.php vs looping inside template file
- Get ID of a page containing secondary loop in content
- Custom Loop and Infinite Scroll
- Loop that displays PARENT PAGE & CHILD PAGE & outputs GRANDCHILD PAGE title and content
- is_home, and is_front_page conditional problem
- Is `query_posts` really slower than secondary query?
- Are there any scenarios where the query_posts may be used?
- the_content and wp_link_pages
- How to use next_post_link and previous_post_link on single posts in search results
- Adding ‘current_post_item’ class to current post in the loop
- How do I get the attributes of a short code from a post?
- Next/Previous Posts Links: Alphabetically and from Same Category
- How can I custom order the results from wp_list_categories?
- ACF Repeater loops and resets – where is the reset_rows() documentation? [closed]
- WooCommerce Product Page Loop – Output All Product Thumbnails
- How can I get next post id after current post id for custom post type