Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Single Project View

Hi, I'm doing "How to Build a Wordpress Theme" and I'm having some trouble with custom post types when he uses it for Work page. How do I link a project to that single view page? Here's my code but it's not working. The browser is giving me an error.



Template Name: GSA Portfolio Page


get_header(); ?>

<div id="middle">


$args = array(
    'post_type' => 'gsaportfolio'

$the_query = new WP_Query( $args );


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

    <span id="page-headings"><a href="<?php the_permalink() ;?>"><?php the_title(); ?></a></span>

    <div class="entry-thumbnail"><?php the_post_thumbnail(); ?></div>

    <div class="entry-content"><?php the_field( 'address' ); ?></div>

    <?php endwhile; else: ?>

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

    <?php endif; ?>


<?php get_footer(); ?>

2 Answers

Zac Gordon
Zac Gordon
Treehouse Guest Teacher

Do you have a single-gsaportfolio.php page setup?

I actually figured out what was wrong. What you said plus I had put a space between gsa and portfolio on the Custom Post Types plugin. no0b mistake. I was going to delete this here post but there is no delete button. Sorry! Anyway, I love Wordpress! And thanks for teaching it and thanks for the quick response! :)

Zac Gordon
Zac Gordon
Treehouse Guest Teacher

Yay! +1 to you ;)

And you're very very welcome :)