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

Jacob Scanlon
Jacob Scanlon
8,994 Points

How to Build a WordPress Theme issues...

I'm having an issue with the custom fields and posts for allisongrayce.com. I've followed along with Zac throughout the build so far, however my work.php file is unresponsive between the header and the footer. Meaning, the content in between is not showing up, ie: work listings and descriptions, level 3 headline, nor the thematic break tag. Also, Custom Fields is not showing up in my WP Admin area/Dashboard. None of the code appears broken and I can not figure out the root of this problem.

Any help or ideas on what could be the cause of this would be greatly appreciated.

Thanks!

My issue is the magically appearing posts There are no work posts as of the "Creating a Dynamic Menu" video, but all of the sudden in the next video "Displaying Custom Posts and Fields in a Template" there are suddenly work posts. Where did these come from? DId I miss something?

Jonathan Brierley
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jonathan Brierley
Python Development Techdegree Graduate 15,292 Points

At the end of the first chapter he says to download the "demo content" (project files for "Adding custom content to the site") and start adding it to the site. It's basically a folder with a work-projects.txt file (which has the majority of info you need) and some .png's.

All you need to do is copy and paste information from the txt. file into a "new project". (I.e. Wordpress Control Panel -> Work (on the left side panel) -> Add Project.)

There's an option to add an image. I just added the images ending with '...-homepage-image'. (but I should note that I've only just done this, and I'm assuming that it's correct).

Somehow I ran into this same issue. I received the badge for the first section, "Content Strategy with WordPress", but somehow never saw the video titled "Adding Custom Content to the Site"

Jacob Scanlon
Jacob Scanlon
8,994 Points

Thank you Jonathan! You are absolutely correct. When I came to this problem, the "Adding Custom Content to the Site" section was not yet up. So I went back and watched it and voila, all my problems are now gone.

Jake, go back and watch that video and you'll be fully up to speed.

Good stuff, thank you all!

1 Answer

Post code.

Please and thank you.

M

Jacob Scanlon
Jacob Scanlon
8,994 Points

<?php

/*

Template Name: Work Page

*/

get_header(); ?>

<p>This is the work.php</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(); ?>"></a><?php the_title(); ?></h3>
<?php the_field( 'description' ); ?>
<hr>

<?php endwhile; else: ?>

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

<?php endif; ?>

<?php get_footer(); ?>