Include Me

Include Me is a powerful plugin that lets you to include in any post or page and external HTML or PHP file or the content of another post/page. When you include a PHP files, they will be executed and their output included, so you can develop independent scripts that can be made available on posts or pages.

Please use the support forum to ask questions.

An example? You want to publish a report generated by some queries on a database. Just develop such script and make it to output an HTML fragment. Then include it on a page with Include Me.

Example two. You want a dedicated page with your Facebook Fan Page widget (which is made of Javascript). Just create a textual file with Facebook widget code and include it with Include Me.

Where is the advantage over developing a theme custom page? Let me answer with another question: what happens to theme custom pages when you change theme?

Include Me syntax

In any post or page you can use Include Me with the shortcode:

[includeme file="filename"]

where the “file” attribute contains the filename to be included. Any textual file can be included and if it is a PHP file (with “.php” extension) it will be executed and its output included.

The filename can be relative (not starting with “/”) so it will be searched starting from the blog root folder (for technicians, ABSPATH will be added at the beginning). If the filename is absolute (starting with “/”) it will be used as is (so you can include files even external of the site root folder).

Including another post content

It’s a rather particular case but you may need to include another post content in a series of other posts or pages just to have a single change point. In this case the syntax is:

[includeme post_id="a post id"]

The “post id” is the nmeric identifier of a post.

Generating an iframe

A second syntax is available and generate an iframe instead to include the file. The iframe syntax is:

[includeme src="url"]

where “url” is a common web address. Any other attribute added to the short tag will be used as an iframe attribute. For example if you write:

[includeme src="http://www.example.com" frameborder="0" width="500" height="400"]

the result will be

<iframe src=”http://www.example.com” frameborder=”0″ width=”500″ height=”400″></iframe>

Nice, isn’t it?

I widely used this plugin (and its old and incompatible version Include It) on my blogs.

Passing variables

If you include a PHP script, it can access the shortcode attributes using the syntax $attrs[‘attribute name’]. For example calling:

[includeme file="out.php" value="My name is Stefano"]

and with out.php

The output will be, of course “My name is Stefano”. So you can create a generic script and make it doing different things using the shortcode attributes.

My excuses for my bad english but it's the only way I have to communicate with you. Would you suggest a correction? Leave a comment, thank you!

One thought on “Include Me

  1. hi, I am excited to know your such amazing plugin.
    I am, currently, using visual composer to built my website. (the VC comes with the theme).
    However, I don’t think I need that much function in my website, I need only some sort of them in all website.
    I wonder the visual composer is slowing my website.

    Therefore, I wonder if it is possible to use your includeme plugin to replace the visual composer.
    But, I am not familiar with php. Is there anything method you think might help me?

    Please advise.

    Thanks in advance.
    Kay

Leave a Reply