O'Reilly logo

WordPress 3 Plugin Development Essentials by Everett Griffiths, Brian Bondari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Add custom text

Our simple widget is technically functional, but it doesn't do anything yet. After you have activated your widget and viewed your homepage, you will see some default text that we pointed out earlier: function WP_Widget::widget() must be over-ridden in a sub-class.

This is the output of the WP_Widget class' widget() function. If we think about our parent/child analogy, here we are getting a message from the parent telling the kid that he needs to take care of this function himself. How do we override the WP_Widget::widget() function? We simply add a widget() function to our ContentRotatorWidget class. Add the following function to the ContentRotatorWidget.php file, somewhere below the __construct() function (remember we like to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required