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

convert custom post type listing template stage: projects background color problem

Ok so im the middle of the "how to build a wordpress theme" course at the "convert custom post type listing template" stage. when i do all the code for the projects to show up on the work page, they show up but i cant change their background or button colour.

Does anyone know why this might be?

I don't think the code is the problem. Maybe i did something wrong with the custom fields?

I've been trying to fix it for a while but nothing is working!

any help would be great :)

Wayne Fonseca
Wayne Fonseca
7,796 Points

Any luck solving this issue?

3 Answers

Chad Pjontek
Chad Pjontek
13,700 Points

I had this issue as well but I found that I did not input all the fields in the admin area under "custom fields/work". Also make sure you use the data to input from the "work-projects.txt" file. That file can be found in the project files zip file from http://teamtreehouse.com/library/how-to-build-a-wordpress-theme/content-strategy-with-wordpress/project-overview

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Couple things to try:

  • Do you see you see the color picker field when you edit a project in the admin area?
  • If you try to call the_field('background_color') in your template somewhere you can see it (like under the title) does the correct color display?
  • If you try to hard code a color into the inline styles for the project, does that work?
Wayne Fonseca
Wayne Fonseca
7,796 Points

Hi Donal,

Ensure the following is properly keyed in:

<?php

$args = array(
    'post_type' => 'work'
);

$the_query = new WP_Query ( $args );

?>