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 WordPress Settings API Creating a Theme Options Page Settings Hooking a Setting into the admin_init Action

Justin Estrada
Justin Estrada
34,995 Points

There'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.

Louis Griffith
Louis Griffith
Courses Plus Student 16,252 Points

This makes sense now. I was going back and forth trying to figure out why my checkbox wasn't showing.

Justin Estrada
Justin Estrada
34,995 Points

Louis, 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
Preston Davis
5,932 Points

The 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.

Preston 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

Hi Justin, I suggest you send a bug report on this to the support team at help@teamtreehouse.com

Justin Estrada
Justin Estrada
34,995 Points

Still waiting for a response on the last email I sent help@tree.. They'll see this.

The 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.

unable 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
Dylan Harris
8,969 Points

The 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
Jacque Porter
5,677 Points

This 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
Jacque Porter
5,677 Points

Here 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
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Having 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.

This 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;

}