Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to integrate a custom slider using a 3rdParty jQuery plugin onto the homepage.

I'm almost there. I need the original featured images and not the cropped ones.

<?php if (is_home()): ?>
<?php
$featured_posts = new WP_Query(array(
    'post_type' => 'post',
    'showposts' => 5,
    'tag' => 'featured'
));
?>
<div>
<?php while($featured_posts->have_posts()): $featured_posts->the_post(); ?>
    <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'featured-image'); ?>                        
    <a href='<?php the_permalink(); ?>'>
        <img src="<?php echo $image[0]; ?>" style="width:940px;height:500px" />
    </a>
<?php endwhile; ?>                    
</div>
<?php endif ?>                

The problem here is that all the images are of 516x340 dimension. How I get the original dimensioned image ?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The second parameter for wp_get_attachment_image_src is $size.

$size
(string/array) (optional) Size of the image shown for an image attachment: either a string keyword (thumbnail, medium, large or full) or a 2-item array representing width and height in pixels, e.g. array(32,32). As of Version 2.5, this parameter does not affect the size of media icons, which are always shown at their original size.

http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src

Per that Codex entry $size can take string values of "thumbnail, medium, large or full". You need "full" to get the full size image, which ought to be the original.

It seems to me like you could save yourself a little bit of trouble with wp_get_attachment_image instead of wp_get_attachment_image_src

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.