Build Your Own Business Website header image

How to Activate a Shortcode in the Multimedia Box

Difficulty Level -

Filed Under Topics - , ,

Listed Under Lesson Subjects -

Whoops, you've found some premium content!

Watch the opening clip of this video to preview it,
the full video is available to paid members.

In this session, we discuss how to use shortcodes with the multimedia box. The multimedia box cannot take shortcode directly since shortcodes have to be filtered through some HTML content and that can only happen in the content area. So the work around is to configure your site so that you can put a shortcode into a text widget and we demonstrate how to do that.

Video Transcript

Well, I’ve got a plugin that I’m trying to put into the multimedia box that uses a shortcode. And I can’t seem to get this plugin to work using the shortcode from the plugin.

Now is there some reason why you want to use the multimedia box?

Yes and no. Yes is that it keeps it contained in one place so I can add other text. Other than that, no.

Unfortunately, the multimedia box can’t take a shortcode. The way a shortcode works is it has to be filtered through some HTML content some place. And by default, the only place that that can happen is inside the content area and that’s where shortcodes were originally developed. I mean, that was the purpose, originally developed for shortcodes. We used to be able to stick some kind of custom functionality inside of the content when you’re typing away.

However, you can configure your site so that you can put the shortcode in a text widget and that’s what I would try doing is I would try putting it in a text widget instead and just not use the multimedia box for that purpose because we can make that work. Is there a reason why that wouldn’t do what you want it to do?

No because I don’t see a reason why it would not work.

What’s the plugin?

It is Image Store.

Image Store. Is that on the WordPress repository?

Yes, it is.

Okay so let’s see, plugins, installed plugins. Add new, Image Store. So it’s this one right here, this plugin was created because there’s a need for the WordPress community to have images store that did not require installation of multiple plugins. This plugin, what it does is it essentially gives you the ability to sell images?

Yes and…

Oh my gosh. Nobody can see my screen, can they?

No.

My mistake, I’m sorry. Now hopefully everybody can see my screen.

Yes, we can.

Okay, I’m sorry about that.  There is one button there I forgot to push. My excuse is I drove 21 hours yesterday and didn’t get a whole lot of sleep last night. So I’ve been a little punch drunk all day. But anyway, Image Store is essentially a way for your to sell your pictures.

Right but what it allows me to do is group them as albums for my clients and password-protect their pictures and create an album and essentially a store that only has their pictures on it.

Okay. And so let’s see, is that this Galleries right here? It must be.

Yes sir.

So let’s look at settings here for just a second. Are you going to put a gallery in there or an image? What were you going to put in there, a slideshow?

I have set up a way to run both the slideshow and the gallery. That’s all driven off of this guy’s shortcode. And I’ve filled the galleries. I can make those work but I cannot make the album work and  I’m just lost with it.

I don’t see any documentation on the plugin here. Am I missing it or…

No. It’s sparse and you have to go to the author’s website.

Okay. So let’s see…

And then if you look under… well, that’s a good place to start. He had a page that was usage that gave the codes. Okay so ims gallery = id such and such.

Right.

And did you say that this will work if you just stick it in the middle of a page or it won’t?

It works in the middle of a page.

Okay. So then here’s what you need to do and I’m going to show you this using an entirely different plugin but I’m going to show it to you using the NextGen Gallery. And the only reason I’m doing that is just to show you, this is another example of a plugin that a slideshow that you can call with a shortcode. That’s the reason why I’m using this as an example. So let’s see, so if I go to my first gallery, this is the shortcode that will insert the gallery. And if you look at the page, there’s the gallery or insert as a slideshow.

Now I’m going to stick it in this text widget here using that same shortcode. So if I copy that shortcode, come on over to Appearance and Widgets and drag a text widget up here and paste that shortcode and hit save, it’s not going to work. But we’re partway there. Okay, right now what you see is a shortcode here and what you have to do is you have to tell WordPress to apply the shortcode function to a text widget. Now are you doing any custom code on this site using custom functions PHP or custom CSS?

Using some custom CSS.

Okay. This will require one line of code in custom functions PHP. And I’m going to… let’s see, where am I here? It’s been a while since I’ve worked on this site and I don’t have my set up anymore. Well, I’m going to show you what the code looks like and then I’m going to do something I tell everybody never to do. Don’t try this at home sort of thing. And then from there, we will make that thing work.

I’m going to first off, open up this custom functions PHP file and data, websites, bear with me while I open this up here. Oh no, I’m looking at the wrong spot again. This is the one I’m working on. Okay so there’s the custom functions PHP file for this site that I’m going to demonstrate this on. And the code that you have to enter here is add filter and then opening and closing parenthesis and then opening and closing single quotes and widget_text. And then go outside of that line, a comma, a space and then opening and closing single quotes again and then do_shortcode. And then go outside of all that and put a semi-colon in and you have you know, completed this line of code.

The right way to do this, once you’ve made that edit is to use FileZilla or whatever ftp application you’re using and to upload it like this, that’s the right way to do this. Unfortunately, you don’t have ftp set up for this site that we’re looking at right now. And rather than spending a bunch of time doing it, I’m going to show you what happens when you do this but you do it the wrong way. And the wrong way is to use the custom file editor.

The reason why it’s the wrong way is because it’s fraught with danger and there’s no way for you to recover from the danger. Not manage options, custom file editor. There’s no way for you to recover from this if you screw it up here. And it’s so easy to screw up that in fact, it gives you this warning note. If you make a mistake you know, it may result in the site becoming temporarily unavailable.

I’ve been there.

So this is not the way you want to edit your custom functions PHP file and I tell everybody not to do it. But here I am doing it anyway. So I’m pasting that code right there, add filter, widget text, do shortcode. And actually, I’m going to paste that code also in the chat window so that you can just take it from there.

Great.

And then when we hit save, that’s been added to our custom functions PHP file. And now when we refresh this, that shortcode’s going to fire. And so you know,  now you’ll have the slideshow. And in this case, it’s going to fire the way I’ve got it set up right now. It fires on every page and if you want different slideshows on different pages then you would use a plugin like Display Widgets or Dynamic Widgets to determine which pages the widget shows up on. Is it the same shortcode on every page?

No, it is not.

Okay and is the content hidden? That is, should that only show up if the right person is logged in?

That is correct. Well, not the right person. The person would log in to an album using a general password, I guess, which is always the bride’s first name which, if they don’t know the bride then they don’t get in, basically.

Sure. So then what I would do is I would use the… but they have to be logged in? I mean, is there a like a WordPress-style login for this?

No.

There’s not, okay. So then you could probably get used… and does each bride have their own… is there a page for each bride?

Yes.

Okay so then I would use the plugin called Display Widgets for this. Let’s see, add new, add Display Widgets. Because Display Widgets will allow you to pick which widgets are displayed on. If you’ve got the page Bunny, that’s her first name and you want to add that widget only to Bunny’s page then once you’re at Appearance and Widgets and you have that Display Widgets installed, you can drop this down here and then you’re going to say “Show Unchecked” which means it’s going to be hidden everywhere except where you’ve checked it. And then you can scroll down here to Bunny’s page, check it, hit save and now, this is only going to show up on Bunny’s page and on no other pages. So now if we refresh this, that won’t show up any longer and if we want to see Bunny’s page, this is the only page it’s going to show up on.

Excellent.

Okay so that’s what I would recommend you do is use that one line of code and use a text widget and then use a plugin like Display Widgets to determine which page that widget is displayed on. And the only downside to that of course, is that if you’ve got 100 clients, you’re going to have 100 pages and you could end up with a… where did it go? You know, you could end up with 100 text widgets, all of which, only display once. So that’s sort of the downside and that’s the nice part of the multimedia library or the multimedia box is that theoretically, you can set something new for every page. It’s theoretically but there’s no way to make a multimedia box activate a shortcode bar.

Got it. Thank you very much.

You’re welcome.

0 Comments… add one

Save $200 on Membership Now!

Start learning today for as little as
$0.82 PER DAY!
THIS IS A LIMITED TIME OFFER!
Subscription Options
0 comments… add one

Leave a Comment