Add ID # to next_image_link and next_image_link

The WordPress

next_image_link

and

 next_image_link 

are two useful function to display the gallery images in the post, but the default link is un-user-friendly, for some of site, the header section is BIG, that means when ever you click the next image, you have to scroll down to see the image, and then you click the next link to view the next image, you can add the ID to each link, then the visitors can go to the image directly, that’s much better.

If you want to add

#content

to the end of the link location for each previous_image_link() and next_image_link(), you can add the following php code to the functions.php to your theme.

function add_content_hash( $link ) { 
    $link = str_replace("' title='", "#content' title='", $link);
    return $link;
}
add_filter( 'wp_get_attachment_link', 'add_content_hash' );
wordpress next_image_link,next_image_link,next_image_link example,<?php next_image_link($size \sonraki̇ >>>\ ); ?>>,php next_image_link(),next_image_link() wordpress,next_image_link(),next_image_link add_filter,how to use next_image_link(),give an id to next_image_link,get next_image_link,check next_image_link,wordpress next_image_link()

Leave a comment