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 How to Make a Website with WordPress Custom Post Types and Fields in WordPress Setting Up Custom Post Types and Fields

Kim Lorimier
Kim Lorimier
6,818 Points

I cannot get my new image field "art" to show up properly. Why would only the alt tag show up instead of the image?

When following the teaching video, all the steps of setting up the custom post types and fields worked properly. But the actual image I uploaded to the gallery is not displaying properly. Any thoughts? Here is my page http://treehousewordpress.suzukisue.com/?page_id=21

Michelle L
Michelle L
601 Points

Did anyone get an answer yet?? I'm running into the same issue.

Nevermind - just realized the video was missing the part where they added the "art" CPT.

6 Answers

Kim Lorimier
Kim Lorimier
6,818 Points

Thanks, my email was down and I just saw this. Yes, I am using advanced custom fields and the CPT settings are just to create a new post type called art. My interface looks identical to the video from treehouse and the functionality works perfectly. Just the image does not show up on the page, the alt text is there instead. I see the images in the media gallery. Thoughts? I tried deleting and re-uploading all the images to make sure the path was correct. Thanks for your help.

Bob de Boer
Bob de Boer
594 Points

Hi Kim, I have the same problem. I re-installed the plugins, etc... nothing. Were you able to solve it?

I have the same problem. Has anyone managed to solve it. If so, how ?

I am having the same issue now. Hopefully, someone can get back to us.

Dylan Weinberger
Dylan Weinberger
1,481 Points

I think I may have figured out a workaround using the Custom Fields documentation here: https://www.advancedcustomfields.com/resources/image/

In my content-art.php file i changed

    <div class="entry-content">

        <p><img src="<?php the_field('image'); ?>" alt="Example image of <?php the_title(); ?>"></p>
        <p><?php the_field('description'); ?></p>

    </div><!-- .entry-content -->   

to this

    <div class="entry-content">
        <?php if( get_field('image') ): ?>
                <img src="<?php the_field('image'); ?>" alt="Example image of <?php the_title(); ?>" />
        <?php endif; ?>
        <p><?php the_field('description'); ?></p>

    </div><!-- .entry-content -->