December 2017
Beginner
458 pages
7h 52m
English
In the function.php file, underneath the add_action function, we will specify the locations. For this, we will add a function called init_widgets, pass in &id, and then add register_sidebar as shown here:
// Widget Locationsfunction init_widgets($id){ register_sidebar();}
The register_sidebar function is used for creating any kind of widget position. Even though it says sidebar, it doesn't have to be in the sidebar; in our case, it is but it doesn't have to be.
Next, we will pass in an array to the register_sidebar function. Add a name, Sidebar, and an ID, sidebar, as shown here:
register_sidebar(array( 'name' => 'Sidebar', 'id' => 'sidebar' ));}
Then we will declare the action using add_action. The hook ...
Read now
Unlock full access