Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Darren Healy
seal-mask
.a{fill-rule:evenodd;}techdegree
Darren Healy
Front End Web Development Techdegree Student 23,565 Points

From Bootstrap to Wordpress: Creating a portfolio landing page

Hi folks

I'm specifically stuck on the section where Zac has identified that the images in the portfolio need to be made more responsive, but after following the video through exactly my images seem to reset and appear full size. I'm a bit stuck on how to fix it.

My code for anyone who might need to see it. However I have essentially taken it back to where it was before Zac takes us through how to make the images more responsive. I'm on windows 8 if it helps any, using chrome. Zac Gordon

<div class="row">

      <?php
        $args = array(
          'post_type' => 'portfolio'
        );
        $the_query = new WP_Query( $args );

      ?>

      <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

      <div class="col-sm-3 portfolio piece">

        <?php
          $thumbnail_id = get_post_thumbnail_id();
          $thumbnail_url = wp_get_attachment_image_src ( $thumbnail_id, 'thumbnail-size', true );
        ?>


        <p><?php the_post_thumbnail( 'medium' ); ?></p>
        <h3><?php the_title(); ?></h3>

      </div>

      <?php endwhile; endif; ?>

    </div>

<?php get_footer(); ?>

2 Answers

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Hey there,

It looks like you're still echoing out a full sized image:

        <p><?php the_post_thumbnail( 'medium' ); ?></p>

What happens when you do this instead:

<img src="<?php echo $thumbnail_url; ?>">