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

Work Image Trouble and Footer

So far everything has been working out but I cannot get my images to show up. I had originally tried putting the image object in my image field and then I changed it to image url, but no images are showing up still. I have the blocks with the background colors and buttons and all the text - just no image.

Also, the twitter widget in my footer is displaced above the other two and to the right. Here is my code to the work page if that helps:

<?php 

/* 

    Template Name: Work Page

*/

get_header(); ?>

<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_slider_image' ); ?>">
        </a>

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

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

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

    </div>

<?php endwhile; else: ?>

    <p> There are no posts or pages here. </p>

<?php endif; ?>

<?php get_footer(); ?>

1 Answer

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Hi!

Let's double check that "homepage_slider_image" is the actual name for the field in the admin area and that there is an actual file uploaded for it on the backend. Once that is done, is the field outputting anything in the source code?