BU Include Plugin

Use the BU Include plugin to embed the content of a page, post, text file or HTML file into another page or post on your site.  For example, if you have a page that lists office hours and contact information, you can use BU Include to embed this information on any other page on your site.  Should your office hours change in the future, you only need to update a single page and the rest are updated automatically.


Including a page or post

Pages and posts must be included by their ID.  The following example would be used to include a post with an ID of 500.

Include by ID
[bu-include id="500"]

Including media

You may include any media that is present in your content directory as long as the filename ends in .txt or .html.  Media may be included by ID or by its location relative to your blog’s files directory.  The latter form can be useful when you have files in your content directory that, for one reason or another, do not exist in the media library.

When including a file by name, you may use a fully qualified URL as long as it points to your blog’s content area.  A simpler alternative is to provide a path to the file relative to your blog’s content area.  The former offers no advantage over the latter.

Include by path
[bu-include src="2010/06/foobar.txt"]
[bu-include src="http://www.bu.edu/myblog/files/2010/06/foobar.txt"]


Recursion is respected. That is, if the included content contains [bu-include …] as well, that will be parsed. However, if a loop is detected (A includes B includes A), the shortcode where the loop occurs is disregarded and left blank. That is, if A includes B includes A, and you view A, then you will see A, with B embedded in it, but A will not be embedded into B again.  By following the same rule, if a page includes itself then nothing will happen and the include is ignored.

For example, consider the following:

Page A, ID = 500
This is page A.
[bu-include id="501"]

Page B, ID = 501
This is page B.
[bu-include id="500"]

If you were to then view Page A, this is roughly what you would see:

This is page A.
This is page B.

Page A is not shown more than once due to recursion protection.


When a post, attachment, or page is updated, any pages which include it have their cache purged.  These pages are identified by first sweeping the database for posts with “bu-include” in their content, and then by looking into each to determine if it includes the post that was updated.