Friday, January 31, 2014

Wordpress - How to Create Multiple instance of Widget ?

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');

A blogger

I am passionate blogger cum B.Tech. Computer engineering graduate. I love writing blog post. I spend my free time in writing blog post that will useful to everyone (including me). I have had some success making money blogging and want to help others do the same. I just figured that by creating a great and free resource a lot of links would follow – and they have. Some people ask me how they can repay me – which is not necessary - but for those wanting to show their appreciation, I just say linking to the article from their blog is the best compensation I could receive. Thanks for reading!

0 comments:

Post a Comment

Thanks for commenting. I will Reply you soon

 

Copyright @ 2013 PHP WORDPRESS MAGENTO .

Designed by KconTechnosoft