Is there a WordPress equivalent to MediaWiki templates

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

Read More

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?

Related posts

2 comments

  1. 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]
    
  2. 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.

Comments are closed.