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 How to Build a WordPress Theme WordPress Theme Functions Displaying Custom Posts and Fields in a Template

No Work info showing on the page

Hi,

I've been following along with every video inputting the details as I go, but I have not now got the information displayed as shown by Zac. When he created the Query, Loops etc. I was up to scratch checked the code all is well but do data ??

I am simply missing the vid where he filled in the data because ive looked and I cant spot it or is there actually not a video covering this part and I need to just fill in some dummy data??

Thanks

2 Answers

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

At the end of the last video of the first stage it instructs to fill in the rest project data from the project downloads.

Do you have it there and are just having trouble displaying on the page or do you still need to add to the admin area?

I've not added any info regarding the "work" page/posts, up to now I've only created the custom posts/fields.

I have the -stage-01 / stage-02 Project Files , but I've not filled in the information in the admin area ...... ooops Think I'll do that now !

Matt Pill
Matt Pill
15,689 Points

Hi,

I'm having a similar issue but I have added some projects into the 'Work' tab and published them. However when I look at the work page I get nothing... what am I doing wrong???

Here is my work.php code:

<?php 

/*

    Template Name: Work Page

*/


get_header(); ?>

<p>This is the work.php file.</p>


<?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(); ?>

    <h3><a href="<?php the_permalink() ;?>"><?php the_title() ;?></a></h3>  
    <?php the_field( 'description' ); ?>
    <hr>

<?php endwhile; else: ?>

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

<?php endif; ?>

<?php get_footer(); ?>