Expiration dates: adding options to our widget

One of the key specifications for this plugin is the ability to set how often content is refreshed. Maybe you want to include a "quote of the day" on your site, or maybe you want to update a chunk of content every hour. Each instance of our widget needs an expiration date.

How do we do that? The solution is a bit tricky, so pay attention. First, we need to add another control option to our widget that allows the managers to set how often the content expires in each widget instance. We are referring to this as the "shelf life", in keeping with some common grocery terms.

Update the ContentRotatorWidget.php file so the $control_options array has an additional option:

public $control_options = array( 'title' ...

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.