How to Create Multiple instance of Widget ?
You need to implement your Widget using the Widgets API, so that WordPress knows how to make multiple instances of the Widget.
Your Widget declaration should take the following format:
class My_Widget extends WP_Widget {
function My_Widget() {
// widget actual processes
}
function form($instance) {
// outputs the options form on admin
}
function update($new_instance, $old_instance) {
// processes widget options to be saved
}
function widget($args, $instance) {
// outputs the content of the widget
}
}
register_widget('My_Widget');
0 comments:
Post a Comment
Thanks for commenting. I will Reply you soon