Displaying widget configuration options
Similar to plugin configuration pages, widgets can have one or more options to allow users to specify how some aspects of the component will behave. These options can be configured individually for each instance of a widget that is added to a website layout. To handle all of the logistics around multiple possible widget instances, WordPress actually takes care of most of the data handling and storage tasks.
Getting ready
You should have already followed the Creating a new widget in WordPress recipe to have a starting point for this recipe. Alternatively, you can get the resulting code (ch10/ch10-book-review-widget/ch10-book-review-widget-v1.php
) from the book's GitHub page and rename the file to ch10-book-review-widget.php
. You should also be running the Chapter 4 - Book Reviews plugin. If needed, you can get that plugin's code (ch4/ch4-book-reviews/ch4-book-reviews-v12.php
) from the book's GitHub page and Activate it.