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


Following WP Tut - Work page is pulling its content from Blog page

Hi everyone,

Currently stuck on 'Convert Custom Post Type Listing' WP Tut, 'Work' page is pulling its content from 'Blog'. The styling is correct, but the content isn't.

This is what I have in terms of coding under 'work.php' -

    Template Name: Work Page

get_header(); ?>

<div class="grid_12 omega clearfix">

    $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 href="<?php the_permalink();?>" >
            <?php the_title(); ?>

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

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


<?php endwhile; else: ?>

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

<?php endif; ?>


    <?php get_footer(); ?>

I have a suspicion the issue is coming from the WP Dashboard. Please could anyone point me in the right direction to fix this issue.


2 Answers

Ben Dickie
Ben Dickie
1,559 Points

have you tried 'post_type' instead of 'post-type' seems they use it on http://codex.wordpress.org/Class_Reference/WP_Query

Thanks mate. It worked! I always get my underscores and hyphens confused.