can't get featured image url using get_post_meta
-
I need to get the url of a thumbnail to create a link.
this is what happen:
I have set some thumbnail size in my function php like this:
add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 226, 135 ); add_image_size( 'gallery-link', 96, 60, true ); gallerie add_image_size( 'gallery-preview', 400, 350, true ); add_image_size( 'gallery-full', 900, 9999, false );
then I have a page with a custom loop:
<?php $preview_img = new WP_Query('post_type=pictures&posts_per_page=18'); ?> <?php while ($preview_img->have_posts()) : $preview_img->the_post(); ?>
an inside the loop I want to link the medium thumbnail to the large one so that cicking on the first the second will be opened in a shadowbox:
<a href="<?php echo get_post_meta($post->ID, 'gallery-full' , true); ?>" rel="shadowbox"> <?php the_post_thumbnail('gallery-preview'); ?> </a>
now I’m gettin the medium picture “gallery-preview” but in the generated html it links to nothing, this is what i can see in the page source:
<a href="" rel="shadowbox"><img src=".. etc
why the href is empty??
I have tested to echo the $post->ID and it works giving the correct post ID.
what am I doing wrong??(the strange thing is that I’m using the exact same code in another blog and it works there…)
- The topic ‘can't get featured image url using get_post_meta’ is closed to new replies.