Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress

derick renwick
derick renwick
3,555 Points

Widgets work but will not "save" (choices are lost on refresh)

Widgets work but will not "save" (choices are lost on refresh) . I followed the directions regarding building a wordpress theme's widgets (custom widget area). The code works and correctly implements the code in the correct place. However, whenever the admin>appearance>widgets page is refreshed the choices(widgets) are lost. This is the code added to my functions.php //ADDING WIDGETS

function create_widget( $name, $id, $description){

$args = array(
    'name'      => __( $name ), //dynamic name for widgets
    'id'        => $id, //widgets id
    'description' => $description, //widgets description
    'before_widget' => '',
    'after_widget'  => '',
    'before_title'  => '<h5>',
    'after_title'   => '</h5>'
) ;

register_sidebar( $args ); //registers args array for widgets. This collects the information needed to display widgets

}

//call this function to create new widget areas. The name Id and Description in that order need to be stated in the create_widget Array create_widget('Sidebar', 'sidebarWidget', 'sidebar widget area'); HELP IS GREATLY APPRECIATED