WordPress.org

Ready to get started?Download WordPress

Forums

2.5 Gallery Sub-Post pages (5 posts)

  1. vandiumsw
    Member
    Posted 6 years ago #

    When clicking on a gallery thumbnail image in a post, the sub-post image page that is loaded (the page were readers can directly submit comments about the picture), displays the thumbnail image again and not the full size image. To get to the full size image I click on the sub-post thumnbail image which takes me directly to .jpg--outside of the WP sub-post. When looking at Matt's sample gallery pages the thumbnails go directly to a page that displays the full size image.

    After much searching and tinkering I can't seem to get around this. Has anyone else had this trouble and found a work around?

  2. hakre
    Member
    Posted 6 years ago #

    Have you found the gallery shorttags documentation?

  3. vandiumsw
    Member
    Posted 6 years ago #

    Yes I have looked at the Gallery shortcode but my take away for that documentation is that I can change the size of the gallery image displayed in the post. I cannot find or do not understand how to get the next page to show the full image. Watching Matt's screen cast makes it seem like a standard feature of the gallery that does not require tweaking of the code.

  4. hakre
    Member
    Posted 6 years ago #

    Gallery Shortcode Documentation in Codex.

    Please provide the Example Blog you talk about. When I make a test with a plain install I can not see any difference to what you describe. Looks like this is the standard way.

  5. phiv
    Member
    Posted 6 years ago #

    I think I found out how to do it:
    Find out function wp_get_attachment_link in your post-template.php file (located in wp-includes) and change it to look like this (one extra code line, one extra comment line):

    // get an attachment page link using an image or icon if possible
    function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false) {
    	$id = intval($id);
    	$_post = & get_post( $id );
    
    	if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
    		return __('Missing Attachment');
    
    	if ( $permalink )
    		$url = get_attachment_link($_post->ID);
    
    	$post_title = attribute_escape($_post->post_title);
    
    	$link_text = wp_get_attachment_image($id, $size, $icon);
    
    	//modification introduced to force the gallery shortcode thumbnail hyperlink to the full size image directly, rather than the attachment page
    	$url = wp_get_attachment_url($_post->ID);
    
    	if ( !$link_text )
    		$link_text = $_post->post_title;
    
    	return "<a href='$url' title='$post_title'>$link_text</a>";
    }

Topic Closed

This topic has been closed to new replies.

About this Topic