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 Plugin Building WordPress Widgets, and Shortcodes WordPress Widgets Code Challenges

Jason Moore
PLUS
Jason Moore
Courses Plus Student 10,297 Points

Challenge 4 out of 6 / How to Create WordPress Widgets

Hello and good day, I am attempting to the challenge that read:

Inside of the widget function, below the extract function, apply the widget_title filter to get the title of the instance. Assign it to a variable named title.

Below is the code I entered.

  function widget( $args, $instance ) {
        // Widget output
    extract($args);
   // EDIT - removed correct answer ;)
    }

The code I entered is coming up incorrect, and is giving me this as an explanation: "The first thing inside the widget method, use the extract function to make $args into local variables."

Please let me know if I am making a mistake. Thank you kindly.

Jason Moore
Jason Moore
Courses Plus Student 10,297 Points

Never mind, I figured it out. In case anyone has the same problem, just delete the comment below :

   // Widget output

I copied this comment from the WordPress Codex, but leave it out for this exercise.

1 Answer

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Glad you sorted it out! Going to edit out your answer for future references not to give away everything ;)

Jason Moore
Jason Moore
Courses Plus Student 10,297 Points

Sounds good! I appreciate the time and work you all put in to help us.