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.

Displaying a widget area on single posts

Displaying a widget area on single posts - WordPress Tutorial

From the course: WordPress: Action and Filter Hooks

Start my 1-month free trial

Displaying a widget area on single posts

- [Instructor] We've got our widget area registered. Now I actually want to place a widget in it and display it on the front end of this site. So let's start by dragging a simple text widget up into the switched area. And since this is a call to action, I'll just give it a goofy title. This is a call to action. I'm sure no marketer would ever recommend using this as an actual call to action, but for example purposes, we'll just go ahead and add that. Okay, let's save it. So I've added this text widget to the widget area, and now I need to tell my plug-in to display this on the front end of the site. And WordPress gives us a way to do that with this dynamic sidebar function. So let's go back to our plugin and see how this works. Let me add some lines here. Okay, so first thing, I want to start by writing my callback function to display the sidebar. And using that dynamic sidebar function, if we look at the documentation,…

Contents