Part 1 – Display Specific Widgets on Blog Posts Only
In this session, we discuss how the Dynamic Widgets Plugin works and then show how to display specific widgets on blog posts only. In part 2, we show how to display widgets on a specific page in Thesis.
But we’re going to start off at first with a tutorial on using the Dynamic Contents widget. We’re going to be using it here on this site that I’m working on. And in this case, what we’ll be doing is we will be selecting videos, placing them in text widgets and then placing the text widget on the appropriate page.
And so we’ll start off by going over to the dashboard. Now, I have already installed this plugin called Dynamic Widgets and when it’s installed, it produces a menu for you down here under Appearance. And if you select that, this is the beginning of your dialogue. And what this does is… well, this interface is divided up into 2 different segments. First is it shows you all of your inactive widgets and then secondly, it shows you your sidebars and what widgets are in your sidebar.
Now, your inactive widgets are those widgets in the bottom panel on your widgets screen. So if we go over to our widget screen here, these available widgets, they are not your inactive widget. Your inactive widgets are these ones down here and an inactive widget is a widget that you have already configured with something in it. So for example, I have a testimonials widget here that once upon a time I configured. It’s sitting there, waiting to be inserted. The same thing is true with a custom menu and with text. You know actually, this is an empty text widget so we can just drag that off of there.
Sometimes it happens that when you’re working on a project, you may swap widgets around and you don’t want to lose a configuration of a widget that you’re pulling out of a sidebar. And so rather than dragging that over to here which would then immediately lose all of its content, what you can do is just drag it down to here and it becomes inactive. But whatever content was in that widget stays so you can drag it back and keep on using it. Anyway, that’s your inactive widgets and this Dynamic Widgets dialogue here shows you those inactive widgets then your sidebars and whatever widgets happen to be in your sidebars.
Now every widget has one of two states. It’s either dynamic which means it’s being controlled by this plugin or it’s static which means it’s isn’t. So a static widget shows up everywhere. It shows up everywhere where the sidebar is included. So if we come back over and look at our widgets here for a second, let’s see, this was the one that was static and you can see right down here it says dynamic widgets static. And what that means is this widget right here which is essentially her opt-in form, this widget shows up on every single page that has sidebar 1. The only page it doesn’t is a page that doesn’t have sidebar 1 and this site, the only instance of that are when you have a no sidebars template. So essentially, it shows up on every page.
However, if we look at this one here, this apply today widget, you can see that it’s specified as dynamic. And if we select that little link, it’s going to take us to the dialogue for that specific widget showing us where it’s being used. So in particular, it has special styling set aside for single posts, attachment, pages, author pages, category pages, archive pages, the error page and the search page. You see the green checkmarks are showing you where there are options that are set for it. If we come back over to dynamic widgets, that is that text widget apply today and you could… we got there from the widgets panel but you can also get there simply here, by selecting edit. And when you select edit, it takes you to that view that we saw before which is essentially the settings for this specific widget.
Okay so what we’re going to do before we go any further is we’re going to create a widget and we’re going to add a video to it. And so I’m just going to grab a text widget and then I’m going to drag it over here and that text widget is right now empty. So I’m going to come over to our Vimeo account and I’m going to grab a video here. This one is going to go on all of our blog posts so select embed. Actually, I better check my settings here real quickly. Okay, we’ve got that set to the right preset so all we need to do is get the embed code, customize the embed options, that’s the right height and the our width, 265 pixels. Grab that embed code, come back over here to the text widget and paste it and hit save.
Now right now, this text widget is static and it’s going to show up on every single page. So if we come over and take a look at this, here’s the new one that I just created or just added and it doesn’t matter what page you look at on the blog page, on any given blog post. It shows up, right? And so we don’t want it to show up on every page. We want it to show up only on blog posts and on the blog page itself. And we don’t want this widget here to show up on the blog page anymore.
So the way we do that is to come back to our Appearance and Widgets panel. Actually, that’s really were we are already. And here, under dynamic widgets, it says it’s static. If you select static, that will give you the chance to make it dynamic. And you’re going to make it dynamic by adjusting settings here. Right now, it’s not dynamic because it doesn’t have any settings adjusted so it stays… it’s still static.
Now you have 2 kinds of control over the display. You can either choose don’t display this widget anywhere except those places I specify or you can say display this widget everywhere except those places I specify. In this case, what we’re going to use is don’t display this widget anywhere except those places I specify. So the place to start off with is set all options to no which means right now, it won’t show anywhere and you have to hit save in order for that to materialize. Let’s go back over to that widget. And now it’s got a setting for all of these.
And so in terms of our single posts, the question is, should the widget show default on single posts and what we’re going to do is we’re going to say yes to this. So we’re going to show this widget on all single posts. And then in terms of templates, not templates… in terms of pages… not pages either. Yeah okay, so we’re just going to show this by default on all single posts. By default on all pages, it is set to no. All in all author archives, all category pages, all archive pages. The error page and the search page, it is set to no. So we’re just going to go ahead and hit save to that.
So now we’ll only display on single blog posts. That’s it and we can see that in action here on our home page, no longer shows up. Go to one of our other pages, it no longer shows up. If we come over to the blog, it does show up. And if we go to a single post, it shows up.