WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I´m using this code:

// get portfolio
$args = array( 'post_type' => 'portfolio', 'posts_per_page' => 100, 'orderby' => 'title', 'order' => 'asc' );
$loop = new WP_Query( $args );    
$port = array();
while ( $loop->have_posts() ) : $loop->the_post();      
        $idx = get_the_ID();
        $year_completed = get_post_meta($idx, 'year_completed', true);
        $website_addr = get_post_meta($idx, 'website_address', true);
        $thumb = get_the_post_thumbnail($idx, 'thumbnail'); //250x200 - featured image
        $title = get_the_title();
        $excerpt = get_the_excerpt();
        $content = get_the_content();

        //get 'Solutions' terms
        $terms = get_the_terms($idx, 'Solutions');
        $terms_string = '';

        //build up comma delimited string
        foreach($terms as $t){
            $terms_string .= $t->slug . ' ';
        $port[] = array(
            'id' => $idx,
            'year_completed' => $year_completed,
            'website' => $website_addr,
            'thumb' => $thumb,
            'title' => $title,
            'content' => $content,
            'excerpt' => $excerpt,
            'terms' => $terms,
            'terms_string' =>$terms_string, //classifications (comma delimited slugs)
            'permalink' => get_permalink(),

$terms = get_terms('Solutions');    

$filters = '<section id="options" class="clearfix">
            <ul id="filters" class="option-set floated clearfix">
            <li><a href="#filter" data-filter="*" class="selected">show all</a></li>';                          

            foreach($terms as $t){          
              $filters .= '<li><a href="#filter" data-filter=".' . $t->slug . '">' . $t->name . '</a></li>';// $t->count
            $filters .= '</ul></section>';


<!-- add this inside entry-content -->
<?php echo $filters; ?>                 
<div id="portfolio">

    <!-- isotope -->
    <ul class="thumbnails isotope">
    <?php foreach($port as $p){ ?>
        <li class="span3 element <?php echo $p['terms_string']; ?>">
            <div class="thumbnail">
                <?php echo $p['thumb']; ?>
                <div class="caption">
                  <h5><a href="<?php echo $p['permalink']; ?>"><?php echo $p['title']; ?></a></h5>
                </div><!-- end caption -->
            </div><!-- end thumbnail -->
    <?  } //end foreach ?>

</div><!-- end #portfolio -->

I´d like to link this to the fullsize image

<?php echo $p['thumb']; ?>
share|improve this question
up vote 0 down vote accepted

You have to do a small bit of magic to get the url with the correct size image:

$image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $idx ), "size" );

You should put in the appropriate thumbnail size for "size" at the end, of course :) Sounds like you'd want "full".

Make this a variable in your while variables, then in your array, call something like:

'thumb-link' => $image_url[0]

(For posterity, the Codex reference for related info: http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src; sizes listed here: http://codex.wordpress.org/Post_Thumbnails)

share|improve this answer
I try: array( ... full_size = wp_get_attachment_image_src( get_post_thumbnail_id( $idx ), "full" ); <a href="<?php echo $p['full_size']; ?>">...</a> I just get "Array" – ogni Feb 25 '13 at 14:28
Yikes! I wasn't paying close enough attention. Try the updated answer. (Need to call the first item of the array.) – jfacemyer Feb 25 '13 at 15:00
Yeah, it works! Thanks – ogni Feb 25 '13 at 15:10
No problem! Glad to help! – jfacemyer Feb 25 '13 at 16:58

Your Answer


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.