From the course: WordPress: Action and Filter Hooks

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Registering a sidebar

Registering a sidebar - WordPress Tutorial

From the course: WordPress: Action and Filter Hooks

Start my 1-month free trial

Registering a sidebar

- [Instructor] In this lesson, we're going to keep building on the plugin that we started previously, and we're going to look at two specific action hooks. We've got widgets_init and register_sidebar. widgets_init is where you would hook into to register a sidebar. So, widgets_init is going to be part of our add action, the hook, and then our call back function will contain the code to actually register the sidebar. So let's head over to our code editor, and this'll start to make a little more sense. Can we add some lines of code, or excuse me, add some empty lines, so it makes it a little easier to see. So first thing I want to do is write my callback function. I'll say function spc_register_sidebar, and then within this function, we want to call that register_sidebar hook. And let's go and take a look at the documentation to see what actually happens here. So this function takes an array of argument, including a name, a…

Contents