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

Konrad Pilch
Konrad Pilch
2,435 Points

What is wrong with this code?

This code here

<?php
        $args = array(
        'post-type' => 'portfolio'
        );
        $the_query = new WP_Query( $args );

     ?>

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

Is the exactly same code as i look as Zac code.
I even pasted Zac code there to display my own portfolio, and it worked! I just dont get it, why mine isnt working , the above code is mine. It looks like i did everything right. But it wont work, while if i paste Zac code, it woudl..

1 Answer

Kevin Korte
Kevin Korte
28,149 Points

It should be post_type. You currently have it as post-type.

Konrad Pilch
Konrad Pilch
2,435 Points

xdd thank you :) at least i know what wrong i did