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 trialCarla Thomas
Front End Web Development Techdegree Student 16,039 PointsBootstrap class img-responsive: How do I display image using PHP code?
I am creating a WP responsive gallery using the Bootstrap class img-responsive. I am also using a WP plugin for custom fields.
Here is the custom field code to display the image:
<?php echo(types_render_field( "gallery-image-2", array( "alt" => "blue bird", "width" => "140", "height" => "140", "proportional" => "true" ) )); ?>
Where does the above code need to be placed in the index.php file below?
<div class=".container-gallery">
<div>
<a href="">
<img class="img-responsive" src="" alt="">
</a>
</div>
</div><!-- /.container-gallery -->
I have tried placing it as a src by omitting the quotation marks first but that did not work.
UPDATE (mission accomplished):
I have finally gotten the image to show by omitting the img tag and replacing it with the custom field PHP.
Ken Alger
Treehouse TeacherKen Alger
Treehouse TeacherEdited for markup.
Ken