ThemeShaper Forums » Thematic


How to link thumbnails to full-image?

(9 posts)
  • Started 9 years ago by Mr.D
  • Latest reply from lastraw
  • This topic is not resolved
  1. Hi All,

    I recently installed Thematic and Gallery child theme.
    I've uploaded all my thumbnails (125w x 125h) and full size images (500w x varioush) but now I would like to have all the thumbnails linking directly to the full-image contained in the corresponding posts. My main goal is to showcase my work using Lightbox Plus and not sending the user to a new page to view one larger file each time.

    I think I've found the code that needs to be changed in the "loop-thumbnail.php" file:

    [a href="[?php echo the_permalink() ?]"]

    Can someone tell me what I need to make the href link to "full-image" instead of "the_permalink"?

    Many thanks.

    Posted 9 years ago #
  2. if you mean just regular photos on a page, there is an option for linking to the full image when you insert into post

    if you mean the actual thumbnails (which seems like it defeats the purpose of a post thumbnail) then perhaps this will help

    $image_id = get_post_thumbnail_id();
    $image_url = wp_get_attachment_image_src($image_id,'full', true);
    $img_src = $image_url[0];

    where $img_src should be the link to the full-sized image

    in theory anyway

    Posted 9 years ago #
  3. Thanks for that Helga. When I used your code, the thumbnails were linking to some random image in my Wordpress folder i.e.

    I've unlocked my site so you can see how the current setup has the thumbnail linking to a post that contain the large image.
    It's this large image in the post that I would like to be able to open by clicking on the thumbnail on the main page.

    I hope this makes sense.

    Here is my site:

    Many thanks.

    Posted 9 years ago #
  4. ahhh.. i have had that problem before. you should do a check to see if it has a thumbnail first.

    if ( has_post_thumbnail() ) {
    $image_id = get_post_thumbnail_id();
    $image_url = wp_get_attachment_image_src($image_id,'full', true);
    $img_src = $image_url[0];

    Posted 9 years ago #
  5. Finally found the solution to my problem with the following few lines of php code:

    	$mykey_values = get_post_custom_values('full-image');
    	foreach ( $mykey_values as $fullimageurl ) {
    	echo '<a href='.$fullimageurl.' rel="lightbox">';

    Found it here:
    The link incorporates the lightbox functionality also (jQuery Lightbox is what worked for me in the end).

    Hopefully this saves someone else more hours of searching!

    Thanks for your help and time helgatheviking.

    Posted 9 years ago #
  6. shyno

    hi Mr.D

    i add the same prob !
    in witch php file, and where do yu put the code for call the lightbox directly on the thumbnail?


    Posted 9 years ago #
  7. Hi Chris,

    The file you're looking for is: wp-content/themes/gallery/loop-thumbnail.php


    Posted 9 years ago #
  8. universalsudhir

    I am trying to solve a similar problem.. If you guys can please help:

    I am a WP/PHP fresher and having problem implementing the code in loop file. I want to use the code for a image gallery page.. with small thumbnails linking to a larger version of image.

    I have uploaded a set a featured image (thumbnail) which appears as thumbnail on the page but don't know where to upload and access the large image.

    With the code I am using I am able to get the link to short thumbnails but it only links to the same image urls (small thumbnails).

    Here's the code:
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    <h1><?php the_title(); ?></h1><hr class="hr"/>
    <div id="portfolio_item_container">
    <div id="portfolio_items">
    $args = array( 'numberposts' => 9, 'offset'=> 0, 'category' => 4 );
    $myposts = get_posts( $args );
    foreach( $myposts as $post ) : //setup_postdata($post); ?>
    <?php $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large'); ?>
    <div class="portfolio_item">
    <?php echo '';
    echo get_the_post_thumbnail($post->ID, 'medium');
    echo '
    '; ?>
    <?php endforeach; ?>

    Please help with the solution.

    Posted 9 years ago #
  9. Hi universalsudhir,

    If you are looking to change the image display size try your image.php file (via HTViking)

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.