Support » Fixing WordPress » Go to post when clicking on picture

Viewing 2 replies - 1 through 2 (of 2 total)
  • Sure,

    You manually have to edit your post template. Have a look at this link: http://wordpress.org/support/topic/image-link-to-post-permalink

    Or you may want to create a function which will overwrite everything within single posts:

    function myImgreplacement_permalink($content) {
    	$format = get_post_format();
    	$searchfor = '/(<img[^>]*\/>)/';
    	$replacewith = '<a href=".get_permalink().'">$1</a>';
    
    	if (is_single() === FALSE AND $format == 'image') {
    		$content = preg_replace($searchfor, $replacewith, $content, 1);
    	}
    	return $content;
    }
    add_filter('the_content', 'myImgreplacement');

    Credit – throwingacbrick.com

    hi, no need to edit code

    just goto admin >> pages >> find here your frontpage and edit it.

    here you had added images. click on image, you will find edit link on it.

    edit it image and popup will display now. in it you will find link option.

    add your choice of link to image and update.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Go to post when clicking on picture’ is closed to new replies.