Chapter 5. Content Rotator

In this chapter, we will learn about a special type of WordPress plugin: the widget. The architecture of widgets has undergone a radical change starting with the release of WordPress 2.8, so now we must talk about Object Oriented programming. We will learn a bit about its power as we extend the WP_Widget class to create our widget. We will also learn how to create a preference page in the manager so we can store our plugin's configuration details.

The plan

What exactly do we want this plugin to do? Our widget will display a random bit of text from the database. This type of plugin is frequently used for advertisement rotations or in situations where you want to spruce up a page by rotating content on a periodic basis. ...

Get WordPress 3 Plugin Development Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.