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 Adding Settings to a WordPress Widget

Daniel Mironis
Daniel Mironis
14,023 Points

Not sure where is the problem

Here's the question: Update the widget function to work with the new num_courses settings field. Assign the 'num_courses' of the instance to a variable named num_courses. Then require a file named widget-front-end.php in the inc folder.

And here's my code:

function widget( $args, $instance ) {
    extract( $args );
    $title = apply_filters( 'widget_title' , $instance['title'] );
    $num_courses = apply_filters( 'widget_title',  $instance['num_courses'] );
    require('inc/widget-front-end.php');
}

2 Answers

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Try simplifying it. It doesn't ask to apply any filters to the num_courses so you should be able to just assign the num_courses instance directly to the num_courses variable.