mercredi 1 juillet 2015

How to add multiple checkbox elements to wp_widget form

I made a widget with multiple checkbox but it didn't save. enter image description here

the code of my checkbox

<input type="checkbox" id="post-'.get_the_id().'" value="'.get_the_id().'" name="include[]" />

and I save it like this:

//save the widget
function update( $new_instance, $old_instance ) {
    $instance = $old_instance;
    $instance['include'] = $new_instance['include'];    
    return $instance;
}

thanks in advance.




Aucun commentaire:

Enregistrer un commentaire