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 How to Create WordPress Widgets

valeriuv
valeriuv
20,999 Points

Why does The Official Treehouse Badges Widget not work? (solved)

When I move the widget to the widget area, the round symbol shows that it keeps loading, and I cannot save it.

class Wptreehouse_Badges_Widget extends WP_Widget {

    function wptreehouse_badges_widget() {
        // Instantiate the parent object
        parent::__construct( false, 'Official Treehouse Badges Widget' );
    }

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

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

        $options = get_option ('wptreehouse_badges');
        $wptreehouse_profile = $options['wptreehouse_profile'];

        require('inc/front-end.php');
    }

    function update( $new_instance, $old_instance ) {
        // Save widget options

        $instance = $old_instance;
        $instance['title'] = strip_tages($new_instance['title']);
        return $instance;
    }

    function form( $instance ) {
        // Output admin widget options form

        $title = esc_attr($instance['title']);

        require('inc/widget-fields.php');

    }
}

function wptreehouse_badges_register_widgets() {
    register_widget( 'Wptreehouse_Badges_Widget' );
}

add_action( 'widgets_init', 'wptreehouse_badges_register_widgets' );
valeriuv
valeriuv
20,999 Points

OK I found the bug:

I wrote strip_tages instead of strip_tags

Thanks!

1 Answer

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Marking correct answer (from above):

"wrote strip_tages instead of strip_tags"