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 trialPaul Imbong
284 PointsAdding multiple images
What would be the process to follow if I wanted to have more than one image added in a post under "My Art"? I tried adding an additional image field in Custom Fields (so there are now two), but for the posts that have only one image, there is a small box with the alt text "Example image of My Art" showing, which is unnecessary.
1 Answer
Rich Bagley
25,869 PointsHi Paul,
In your PHP file try wrapping each one the extra images in the following (1 per image):
<?php if ( get_field( 'name_of_your_image_field' ) ){
//Your original code goes here.
} ?>
name_of_your_image_field should vary dependant on the field.
Does that help?
-Rich