Get Creative: Include Any File or PHP Anywhere on Your WordPress Site

Get Creative: Include Any File or PHP Anywhere on Your WordPress Site

Get Creative!

I don’t know about you, but I’m constantly thinking about how to present content in different ways on a site. And so I love plugins like AmberPanther WP Include File.

Once you’ve had a site up and running for a while, you start to think of creative and BETTER ways of presenting content to your visitors. You start thinking, “If only I could get this into here.”

And though it isn’t always possible with straight out-of-the-box WordPress, you know there’s a plugin that will do the trick.

AmberPanther WP Include File Plugin in Action

To give you one small sample of the AmberPanther plugin, I tested out putting a login form at the bottom of a page. Calling a login form, after all, is something you would need to use PHP for.

After setting up a folder on my server for the different files I might include (the plugin does a good job of giving instructions for all this), I made a file called sample.php.

In the sample.php file, I made the following very simple file:

Although I haven’t included any styling, you could if you wanted to, of course. You can basically make it as complex as you like.

At the bottom of my page in the WordPress editor, I included the short code: [include file="sample.php"]


The result, as hoped for, was a perfectly functioning login form where I had placed my short code:

FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

Suggested Use: Call in Other Plugins

As mentioned, you can get as complex as you like with the file you’re calling in. But one thing some people might want to do is to use this plugin to call in other plugins.

You don’t always need every plugin showing on every page or post of your site. And if the plugin doesn’t offer shortcodes as a possible solution for you, then you’re stuck.

However with AmberPanther WP Include File, you can just put the code that calls the plugin into a file on your server, and then call that plugin wherever you like.

As an example, I installed a plugin that allows me to put a flash slider on my site. I only wanted to call this slider on certain pages, however. And so I just put the code for that plugin in a file.

(For this demonstration, I just put it in the same file where I had the login form code.)


And the result, of course, was the flash slider appearing below the login form.

Style Posts

Another possible advantage of such a plugin is that you can use it to apply a style to posts that are used infrequently. As the plugin’s author says, “Just enclose the style definitions in the style tags, save it in a file and include it in the specific post using AmberPanther WP Include File. Hence you save on bandwidth and load times by not loading unnecessary style definitions where they are not needed.”

Only Limited by Your Imagination

A plugin like this can get you thinking. The flexibility it offers might be just the medicine to help you do something you’ve wanted to do but couldn’t figure out how you might do it.

In my testing, I found the AmberPanther WP Include File plugin to work nicely, and it comes with some other well thought out features such as storing options as one array in the database to minimize database cluster and completely removing all traces of the plugin from the database if you choose to delete it.

You can find the AmberPanther WP Include File plugin here.

 

 

(Thanks to Kerrie Longo for the image.)

 

Tags: