August 2017
Beginner
412 pages
10h 30m
English
Let's start with the widget initiation function. Blank, it looks like this:
public function __construct() {
$widget_ops = array();
$control_ops = array();
parent::__construct('base-id', 'name', $widget_ops,
$control_ops);
}
In this function, which is the constructor of the class, we initialize various things that the WP_Widget class is expecting. The first two variables, to which you can give any name you want, are just a handy way to set the two array variables expected by the third line of code.
Let's take a look at these three lines of code:
Read now
Unlock full access