Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 -->