I am a WP/PHP fresher and and trying to link a wordpress featured thumbnail image to larger image url but 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!