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

Chris Kosednar
Chris Kosednar
4,541 Points

custom post types not saving image upload or descriptions

the page 'My Art' displaces fine, but with none of the Img, Description, or Price that I input in the art post type. I went back to the art posts, and none of the above fields saved, the posts are blank except for the title

fyi - i'm using the twentyfourteen theme instead - so maybe the project download files are not suitable across themes (the project download art.php etc might not be compatible?)

1 Answer

Rune Rapley-Møller
PLUS
Rune Rapley-Møller
Courses Plus Student 24,411 Points

Maybe your fields are not linked to the right post.

Make sure that the set the rules correct under the Custom field Group. Like this: "Post-Type" -> "My Art".

Are you using the Repeater field? If you are then you need to remember to use a while loop to get the sub fields

example:

if( have_rows('art') ):

// loop through the rows of data
while ( have_rows('art') ) : the_row();

    // display a sub field value ?>
    <img src="<?php the_sub_field('Img') ?>" alt="<?php the_sub_field('Decription') ?>">

<?php endwhile;

else :  
    // no rows found    
    echo "No Repeater rows found!";

endif; ?>