Content Mirror

This WordPress plugin makes it possible to show content from one page on another – it mirrors content. It’s a very easy to use, but yet a powerful plugin.

It takes content from pages, posts and custom post types and shows it on other pages, posts or custom post types. It also works between sites in a Multi-site configuration. For instance, if you have a web site with one site for each language, you only reuse the same information on all sites.


You can download the latest version from the WordPress repository.


  1. Upload the full directory into your wp-content/plugins directory
  2. Activate the plugin at the plugin administration page

How to use

Once you’ve activated the plugin in your WordPress server you invoke Content Mirror in the editor.

Within the editor, make sure Kitchen Sink is available and then press Insert Content Mirror button.

You’ll now see the Content Mirror Selector Window.

Select what content you want to mirror and press Insert. To get back to the Content Mirror Selector, just press the top left button in the blue square representing the Content Mirror. The delete button next to that, yes, it deletes the Content Mirror.

Advanced use

There’s even more ways of using this plugin:

  • Use Content Mirror Variables
  • Write Shortcodes, Plugins and Themes compatible with Content Mirror

Use Content Mirror Variables

Let’s say you have page “Swedish Tools” which content you want to show on page “All Tools”. So, you edit page “All Tools”, inserts a Content Mirror-object and points it to page “Swedish Tools”. Everything is fine.

Then you think, mmm, I want some parts of that page “Swedish Tools” to be different if user watch it thru page “All Tools”. So you insert a conditional tag at page “Swedish Tools” that looks like this:

[contentmirrorif name=lookdifferent value=true]

And then you go back and edit page “All Tools”, look for the content mirror shortcode in HTML-mode and adds a variable to the shortcode manually, like this:

[contentmirror site=1 posttype=page item=34 lookdifferent=true]

Page “All Tools” will now display the text “THIS LOOKS DIFFERENT”, and that will not be the case when looking at page “Swedish Tools” directly.

You can also echo those Content Mirror Variables using a shortcode like this:

[contentmirrorvar name=lookdifferent]

– That will display true, in this case.

Write Shortcodes, Plugins and Themes compatible with Content Mirror

When writing php-code you can detect whether the actual content you’re generating is inside a Content Mirror or not, by using the global $content_is_mirror like this:

global $content_is_mirror;

if ( isset ( $content_is_mirror ) && $content_is_mirror === true ) {
    // We are inside a content mirror!
    // Do your thing here
    echo 'You've doubled me!';

You can also get the Content Mirror Variables thru code like this:

global $content_mirror_params;

if ( isset ( $content_mirror_params ) &&
     isset ( content_mirror_params['lookdifferent'] ) ) {
    echo content_mirror_params['lookdifferent'];

This produces the same result as the shortcode contentmirrorvar above.
If you’re using Content Mirror in a multi-site configuration and want to detect what site the content is mirrored to, you can use the content_mirror_original_blogid-variable, like this:

global $content_mirror_original_blogid;

$this_site_name = get_option( 'blogname' );
$visitor_site_name = get_blog_option( $content_mirror_original_blogid, 'blogname' );
echo 'You might think you're visiting ' . $visitor_site_name;
echo 'But infact, you're reading ' . $this_site_name;
echo ' - Greetings!';

More advanced usage

Put this code in functions.php if you want the content-mirror only to get content that is wrapped inside a certain class-name. This example only copies content that is inside a div-tag with class name ‘only_mirror_this’

add_filter('content_mirror_output', 'my_content_mirror_output',10,5);

function my_content_mirror_output ( $post_content, $site, $post_type, 
                                                  $item, $post_item ) {
	$class_name = 'only_mirror_this';
	$filtered_output = '';
	$dom = new DOMDocument;
	$xpath = new DOMXPath($dom);
	$entries = $xpath->query('//div[contains(@class,"' . $class_name. '")]');
	foreach ( $entries as $entry ) {
		$filtered_output.= $entry->ownerDocument->saveXML($entry);
	if ( $filtered_output != '' ) $post_content = $filtered_output;
	return $post_content;


This plugin is released under the GPL, you can use it free of charge on your personal or commercial site. But every small donation for the time I’ve spent writing and supporting this plugin is very appreciated.


Unfortunately I can’t give any support on this plugin except what can be found at the WordPress forums for this plugin. Please don’t comment below for support questions.

One Response to “Content Mirror”



A good idea on this plugin!

However when mirroring pages, I need some content to be different. It seems on your example that people can just add content that’s not on the original page, not change it. Am I wrong?

Leave a Reply

Klas Ehnemark | Hong Kong | Stockholm | Ă–land | click for Email | Rendered by Wordpress in 0.294 seconds