ThemeShaper Forums » Thematic

[closed]

How to link thumbnails to full-image?

(9 posts)
  • Started 3 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 3 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 3 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.
    /wp-includes/images/crystal/default.png

    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: www.brand.lu

    Many thanks.

    Posted 3 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 3 years ago #
  5. Finally found the solution to my problem with the following few lines of php code:

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

    Found it here: http://codex.wordpress.org/Function_Reference/get_post_custom_values
    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 3 years ago #
  6. shyno
    Member

    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?

    thans
    chris

    Posted 3 years ago #
  7. Hi Chris,

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

    Best.

    Posted 3 years ago #
  8. universalsudhir
    Member

    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">
    <?php
    $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 '
    '; ?>
    </div>
    <?php endforeach; ?>
    </div>
    </div>

    Please help with the solution.
    Thanks!

    Posted 3 years ago #
  9. Hi universalsudhir,

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

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.