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 trialJustin Estrada
34,995 PointsThere's a section of this lesson missing.
The lesson doesn't go over (skips) the part when the input variables are placed in the checkbox callback function.
Justin Estrada
34,995 PointsLouis, I looked at the project downloads and paused the video in the right spot in the subsequent lesson to get the code I needed.
7 Answers
Preston Davis
5,932 PointsThe Author really needs to go back and rectify this omission as this may cause unnecessary confusion. How about an addendum video focusing on the missed info? Zach? You listening?
Otherwise this course was great.
Gloria Dwomoh
13,116 PointsPreston Davis it is better you tag the person you are referring to otherwise they might never read your post. Anyways here you go cc: Zac Gordon
Gloria Dwomoh
13,116 PointsHi Justin, I suggest you send a bug report on this to the support team at help@teamtreehouse.com
Justin Estrada
34,995 PointsStill waiting for a response on the last email I sent help@tree.. They'll see this.
Gloria Dwomoh
13,116 PointsThe working days for Treehouse team are Monday - Thursday. Hopefully you'll get a reply around then.
Additional info: Ps. Also the email you linked is incorrect, I hope you sent an email at one I linked.
Kristjan Reinsberg
50,960 Pointsunable to see rest of code.. at checkbox callback function ( code out of teacher screen + video part missing where he should write the code )
Dylan Harris
8,969 PointsThe rest of the input/label code can be found in the next video "Coding Out a Theme Options Page Setting Form" at 5:10 for a split second.
Jacque Porter
5,677 PointsThis issue still persists. It'd be useful if the snippet of code missing could at least be posted. Obviously the most helpful solution would be a video explaining the code as well but I understand that that would take some time. Gloria Dwomoh Zac Gordon
Jacque Porter
5,677 PointsHere is the code he skipped over
function wpt_slideshow_checkbox_callback() {
$option = get_option('wpt_show_slideshow');
$html = '<input type="checkbox" id="wpt_show_slideshow" value="1"' . checked(1, $option, false) .'/>';
$html .= '<label for="wpt_show_slideshow">Check to enable slideshow on the homepage</label>';
echo $html;
}
He makes a slight change to this code in the very next video.
Jonathan Grieve
Treehouse Moderator 91,253 PointsHaving just gone started this course myself in the last couple of days, my assumption was that Zac was going to introduce all of this code in the next video. https://teamtreehouse.com/library/wordpress-settings-api/creating-a-theme-options-page-settings/coding-out-a-theme-options-page-setting-form.
I'm a little confused as I never felt like anything has been missing out of place so far because even Zac says at this point we haven't actually coded anything that adds form fields to the page.
Jonathan Grieve
Treehouse Moderator 91,253 PointsHere's a link to another thread that may help people with showing the form fields on the Theme Options page.
https://teamtreehouse.com/community/error-in-project-downloads
Jonathan Grieve
Treehouse Moderator 91,253 PointsFurthermore I've added another post with the correct code, available in the project downloads.
The correct code for saving the checkbox setting on the WordPress Settings API course.
Hoc Code
Courses Plus Student 917 PointsThis is the code you need:
function wpt_slideshow_checkbox_callback() {
$option = get_option( 'wpt_show_slideshow' );
$html = '<input type="checkbox" id="wpt_show_slideshow" value="1"' . checked( 1, $option, false ) . '/>'; $html .= '<label for="wpt_show_slideshow">Check to enable Slideshow on the homepage</label>';
echo $html;
}
Louis Griffith
Courses Plus Student 16,252 PointsLouis Griffith
Courses Plus Student 16,252 PointsThis makes sense now. I was going back and forth trying to figure out why my checkbox wasn't showing.