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?
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 calledmy-text.php
you could use:Or if you just want to go the shortcode route and call a snippet in your editor you can do something like:
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.