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

Trent Burkenpas
Trent Burkenpas
22,388 Points

I can not get Description of Work post to show up!

So the past couple of days I have been struggling to show the description of the work post to show up. I think there is no errors in my code and I made sure to label everything correctly.

<?php

/*

    Template Name: Work Page

*/



get_header(); ?>

<p>This is the work.php file</p>

<?php

    $args = array(
        'post_type' => 'work'
    );

    $the_query = new WP_Query( $args );


?>

<?php if ( have_posts() ): while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

    <h3><?php the_title(); ?></h3>
    <?php the_field('description'); ?>
    <hr>

<?php endwhile; else: ?>

    <p>There are no post or pages here</p> 

<?php endif; ?>

<?php get_footer(); ?> 

Any advice would be great ! Thanks!

2 Answers

Nathalie C
Nathalie C
2,594 Points

If the title is being picked up ok, and therefore the loop is working, I would double check the spelling on the label for your custom field from within the Advanced Custom Field setup.