And so the next thing we’re going to do is control how widgets are displayed, or more to the point, when widgets are displayed. Because right now my course list now shows up here on the front page as well and then if we come in as if we’re not logged in, so let’s just log out.
Log out, Firefox, go back over and look at it. “My Course List” is here but it doesn’t show anything because, of course, I’m not logged in so none of my courses are going to show. But I don’t really want “My Course List” to show up here on this page, and really if I’m looking at one of the product pages I don’t want it to show up on one of the product pages either. So this is what we’re going to do then, we’re going to learn a method of controlling which pages, and posts, and whatever this widget is displayed on.
Now I have shown a couple of other systems for this in the past, but what I’m going to demonstrate today is a new plugin. It is called the Dynamic Widgets plug-in. And it gives you some control, it gives you an added level of control, actually it gives you a couple added levels of control, but one in particular that we’re going to talk about today is based on the WordPress user rule. Now the other plugin that I have taught in the past is called Display Widgets, and Display Widgets is a nice, simple, functional, control except that in my opinion it doesn’t scale very well if you end up with hundreds of pages, or posts, or categories. It’s quite nice I think for a small site, but it doesn’t scale well for a large site. So we’re going to pick this other one which I think has an interface that scales better for a large site.
And we’re going to start off by simply installing that plugin. And we’re going to add new plugin. This is Dynamic Widgets, and it is Dynamic Widgets by Qurl. We’re just going to go ahead and start that now and activate the plugin. Now the dynamic widgets plugin has added a couple of specific things to the widgets. If we open up that text widget now you can see that Dynamic Widgets says that this widget is static.
And so Dynamic Widgets introduces this concept of static and dynamic for widgets, and in fact if you click on that it brought you directly to the . . . pardon me, that isn’t what I wanted to do. If we go back to our widgets for a second here and look down at this menu item that’s Dynamic Widgets under the appearance menu, we can see that for each one of these things it says it’s static. If you edit the widget, if you make any changes here at all, it becomes a dynamic widget. And a dynamic widget then is one that doesn’t necessarily show everywhere. So right now all of our plugins are static, but what we’re going to do right now is make this option a dynamic one and we’re going to set this option to display based on role. And what we want to do is make this widget show to everybody except an anonymous visitor. So we’re going to go ahead and say “Yes”, show to administrator. Actually pardon me, do you want to show it to everybody the answer is no, and then you only want to show it to these guys. Now this is the only one of his settings that works this way, all the rest of the settings have a different method with yes, no, and exceptions. This one just has yes or no with something that you would click there.
But in any case, we’re going to say no we don’t want to show it to everybody and then we do want to show it to all of these people but we don’t want to show it to an anonymous user. And if we hit save there, we can come back over and look at this in Firefox when we’re not logged in and it doesn’t show up. Let’s refresh it. It did just show up. Obviously I turned the wrong one off, I turned off the little advertising one. So in this case, let’s say we want the advertising one only to show up to visitors. So we turn everybody else off but we just show it to these visitors and now we hit save. And if you go to the dashboard now and refresh it, that ad no longer shows up. But if you come over here and look at in on Firefox, yeah it does show up.
And so we’re going to do the analogous setting, the setting that we intended to do a moment ago for “My Course List,” so again if we come back over here to Widgets and the text is “My Course List,” it’s currently set to static, but if we click on it and go back to this role and say don’t show it to everybody only show it to administrator, editor, author, contributor, subscriber, and member and hit save. Now come back over to the Firefox and we’re not logged in, refresh it, and now the course list doesn’t show. So we have a system in place right now where we have some widgets that are going to show up to anonymous unlogged-in members, and some widgets that are going to show up to people who are logged in. And we can see that behavior right now when I log in. And now the course list shows but the advertising doesn’t show. We were at the home page, and see the course list shows but the advertisement doesn’t show.
I want to show you a couple of other things that that plugin can do while we are at it. So if we come back over here to my course list and select “Dynamic”, we can also set these widgets to show within a specific date range. So, for example, if you’ve got a sale and maybe you’ve got a purchase product button that is on a sale or on a coupon and you want that to only display for a certain period of time, you can use this from and to to display. And in fact these things can compound so you can display this only to anonymous users, and only from this date range. Interestingly, they’ve also got one of them here for browser specific displays. And I suppose that if you really did only want to display something to somebody who was using a different version, you could certainly do that. I think that’s probably the least useful of your options here. Also “Templates” is not a particularly useful option in Thesis because we have a limited range of templates. Even if you were to create custom templates it wouldn’t show up in here.
However single posts, this could be fairly interesting because you could decide to have this display on all single posts or in specific single posts. You’ve got two ways of doing this. First you can say “Show widget default on singles posts,” and then you can decide if it’s yes. So you want to show it on all single posts except, and now you’ve got an exception rule, except . . . oh I guess this works this way too. Oh, what happens here is if we say this I bet if we go to a post now it’s going to give us a chance to, right here. So now we could choose to display the widget specifically on this post. So that’s one way you can do it. You can make it post, or specific this way. Another way you could do that would be to come back over here. I think I just lost my . . . where did it go. OK, here we are. However another way to do this would be instead to say shown on default single post, show the widget default on single post. And then you can say accept posts in say this category or accept posts by a specific author, or user in this case. So it is possible for you to make exceptions this way, so you can say that I want to show this widget on all posts except for posts in these categories. You can also do it the opposite and say that I don’t want to show this on any post except for posts in this category. So that’s how this yes, no, except works. So yes, show it on all posts except those in this category, or no, don’t show it on any posts except posts in this category, or posts by this user. And/or, instead, make it allowed to be said on a page by page basis.
So it’s a pretty powerful plugin here for posts. You know, attachment pages aren’t something that we really care about very much, so we’ll just say yes or no as the mood strikes you. Now in terms of the static pages, this gives you a chance to decide which static pages this might show up on.
In particular, if we wanted to show the widget by default on static pages, let’s say no, we’re not going to show this widget by default. Which one is this. . .this is the advertising one. We’ll say yes, show up by default except that we don’t want it to show up on any of the course pages or any of the course children pages. So if we say that now, and actually let’s change the role, let’s just say show this to everybody. Now if we come back over here we’re on a course page, and since we are on a course page it is not going to show up. If we come over here to the home page, it still does show up. If we come over to our profile page it’s not going to show up because this profile page is created by the forum. If we come over to member support it shows up. If you come over to the blog it shows up. So you have that range of control where you can decide you want to show the advertisement to everybody but you don’t want it to show up on a course page or any of the course sub-pages. You can see that each of the levels of the course sub-pages, or the course child pages, it doesn’t show up on.
And then let’s take a look at a couple of other settings that it has. So if we come back over here to Dynamic. If you’ve got author pages you can make the same kind of choices about author pages. For category pages, again you can make the same kinds of choices about category pages. So you have a category specific widget, something that you only want to show up in one specific category, well then you can use this system here for saying that it should display on that category. And then archive pages. This represents any archive pages except for the category pages. You probably recognize that a category page is in fact an archive page. And so they’re taking category pages out separately. If you said no to this then it wouldn’t show up on any of the date archived pages and it wouldn’t show up on tag archive pages.
And then you have an error page and you have a search page. So you could have widgets that you want to show off only on one of these two pages as well. So you can see that this is a very powerful tool for specifying when a widget should be displayed. And it’s fairly easy for you to return everything to no simply by doing that and saving it.
Oh isn’t that interesting, that’s what’s saving it to no. So if you want to change this, well that is a handy little deal. I was mistakenly under the impression that “Set all options to ‘No’” meant that it was not going to show up, that you are essentially taking it back to its original state. But that is not actually what this is.
What this really does is that it makes it so it’s not going to show up at all unless you come along to one of these things and say display it. If we wanted to take this and we wanted to reset it back to a static state you would hit this reset button. So now it doesn’t have any controls and it’s going to show up everywhere. So that is the course list which we have set up as dynamic, and then our advertising text widget which we’re going to set back up as dynamic and we don’t want to show it to everybody. We only want to show it to anonymous users and we hit save.