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

PHP How to Build a WordPress Theme Converting Static HTML into WordPress Templates Convert Custom Post Type Listing Template

posts and buttons not showing up

i'm pretty sure i've duplicated the code from the tutorial correctly but for some reason it's not pulling both of my work posts and the buttons are not showing up in my demo site. As a side note I have added homepage images and button colors to the work posts I've created. Any thoughts?

<div class="grid_12 omega clearfix"> <?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(); ?> <div class="grid_6 spotlight project" style="background-color: <?php the_field('background_color'); ?>">

        <a href="<?php the_permalink(); ?>">
            <img src="<?php the_field('homepage_image'); ?>">
        </a>

        <h4>
            <a href="<?php the_permalink(); ?>"><?php the_title( ); ?></a>
        </h4>

        <?php thefield('description'); ?>

        <p>
            <a class="btn blue" href="<?php the_permalink(); ?>" style="background-color: <?php the_field('button_color'); ?>">
                View Project &rarr;
            </a>
        </p>

</div>

1 Answer

Missing under score in the_field

</h4>

    <?php thefield('description'); ?>

    <p>