Image Store: link from album to a different page

A while ago, one of the Image Store forum a member asked if there was a way to link the albums to the “slideshow” page instead of the “photos” page in the gallery. The answer is yes and this is how is done.

The album can be link to anything that you want not just to the gallery page. All you have to do is add the following  code in your plugin or the functions.php file in your theme. The code as it is will affect all the galleries. But if you have knowledge of WordPress API you can modify it to fit your needs.

function ims_change_album_gallery_link( $permalink, $post ){
	if( empty( $post->post_type ) || $post->post_type != 'ims_gallery'|| is_singular('ims_gallery'))
		return $permalink;

	global $wp_rewrite;
	if( $wp_rewrite->using_permalinks() )
		return $permalink . "/slideshow/";
	else  return $permalink . "&imspage=slideshow";

}add_filter( 'post_type_link', 'ims_change_album_gallery_link', 50, 2 );

Leave a Reply

Your email address will not be published. Required fields are marked *