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

Building Widgets code challenge error message tells me to extract args. I have. Help me find my mistake?

Hi --

I'm doing the first Code Challenge for Building Wordpress Widgets, Stage 4. The fourth task is:

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.

I've taken the code from the Treehouse project files:

    function widget( $args, $instance ) {
    // Widget output

    extract( $args );
    $title = apply_filters( 'widget_title' , $instance['title'] );

}

I get an error message which says:

Bummer! The first thing inside the widget method, use the extract function to make $args into local variables.

I've done that, using the Treehouse code exactly. I searched around to try to find another way to write it, but this seems to be the standard way.

Could you guys help me figure out what I'm doing wrong?

Thanks!

Laura

1 Answer

For some reason the comments are breaking it, remove your comment.

That did it! Thanks! I didn't even consider the possibility that a comment would mess up a code challenge.