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


Ralph Morris
Ralph Morris
3,780 Points

Creating a widget mistake How to fix


Hope somebody can help me.

I have been following tutorials on making widgets and made a slight mistake as you can see below. (The semicolon after the bracket on line 1). this completely crashes the wordpress site I was working on. I'm pretty certain it was that as I tested the same piece of code in another wordpress installation and it did the same thing. However when I deleted the semicolon in the other wordpress installation it fixed itself. But not in the project I am working on.

When running this piece of code does it change anything else outside of this file?

Many thanks!


function create_widget( $name, $id, $description ); {
    $args = array(
        'name'          => __( $name ),
        'id'            => $id,
        'description'   => $description,
        'before_widget' => '',
        'after_widget'  => '',
        'before_title'  => '<h5>',
        'after_title'   => '</h5>' 

    register_sidebar( $args );

create_widget( 'Left Footer', 'footer_left', 'Displays in the bottom left of footer' );
create_widget('Middle Footer', 'footer_middle', 'Displays in the middle of footer');
create_widget('Right Footer', 'footer_right', 'Displays in the bottom right of footer');

2 Answers

Zac Gordon
Zac Gordon
Treehouse Guest Teacher

Hi, do you have all of this wrapped in php tags in your functions.php file? Sometimes PHP errors there will break everything. What happens when you remove all of this code and run your site. No problems?

Ralph Morris
Ralph Morris
3,780 Points

Hi Zac,

Thanks for your reply. Yes it was all wrapped in php tags. I tried just removing the code and it didn't fix itself. However when I removed the theme completely wordpress worked again. So I corrected the error I knew I had made, changed the name of the theme and re-uploaded and it worked perfectly! Odd.

Thanks for your help. I'm following your 'How to Build a Wordpress Theme' tutorials. They're great! Very pleased I was recommended to Team Treehouse.