I'm new to WordPress and already in dire need of a way to reuse common page content. For example we have 10+ product pages and in different areas of each product's page I want to include a textual statement. In MediaWIKI they have a system of Templates which area awesome! You define a template with the content you want included and then include the template in pages. It's like a pre-processor merge system and will dump the contents of the template into the page where it's called for.

The following topics seem to be close to what I want but not exactly

I found the Post Snippets plugin and it sounds like it could be a good fit but I wanted to ask here if anyone familiar with MediaWIKI knew of a more appropriate option?

2 Answers 2


Well there are two easy answers to this , one being an actual template and the other being more of a snippet.

You can use get_template_part to call an actual PHP template file, for instance if you have a file called my-text.php you could use:

get_template_part( 'my-text' );

Or if you just want to go the shortcode route and call a snippet in your editor you can do something like:

function footag_func() {
     $foo = 'Brown Cow'
     return $foo;
add_shortcode('footag', 'footag_func');
// then just use [footag]
  • Thanks for showing how to do this with PHP. I should have clarified that I wanted an "editor only" solution.
    – Steve K
    Sep 30, 2013 at 6:58
  • Plugin recommendations are off-topic on this site, the shortcode is how you would do it via the editor.
    – Wyck
    Sep 30, 2013 at 22:43

I should have tried the Post Snippets plugin before asking this question - it's fantastic on does just what I needed it to. I ran into one slight issue (for me) where simply extracting Page content to a Snippet did not result in the exact same rendered output. I posted a question on the support forum and you can check that for a solution maybe.

  • I had a brief look on Post Snippets. I don't think the "template" this plugin provides can have logical expression like {{#if:...}}.
    – Gqqnbig
    Dec 30, 2014 at 4:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.