(I am not sure if I am phrasing this correctly, so please bear with me and be kind. )

I have a setup where the same information need to be included in both pages, and individual Events (Custom post type from Event Manager) AND in the email template for Event Manager.

Is there a good way to include this from a central location, like post snippets? I tried with the plugin Post Snippets, but of course that only works on posts.

Is it possible to put the information in the functions.php file and then call the variable in all these different places? Or is there a better way to do it that would still allow for the site administrator to edit the text with a WYSIWYG-editor? Thanks for you help and patience.

  • Question is not clear. Provide an example of what you want to include. A simple function in functions.php can however handle this, guessing you are interested to show some texts. – тнє Sufi May 9 '14 at 15:31
  • I need to include the cancellation policy for example - so that would be a good chunk of HTML / Text. – Anders Carlén May 9 '14 at 15:32

You can do this by adding a function like below in your functions.php file:

function my_cancellation_policy () {
    return 'Your text here';

Then you can print this way:

echo my_cancellation_policy ();

If you are about to put html code in there make sure you don't mess up with the single and double quotes.

  • Thanks. That could defintely work. I am just hoping for a better way to allow the site adminstrator to do small changes to the text themselves. I realise I did not included that in the original question. I updated it now. – Anders Carlén May 9 '14 at 15:40
  • Oh - bummer. Can't upvote your answer just yet. Need some higher rep. first. If I could I would though! – Anders Carlén May 9 '14 at 15:41
  • If you want these texts to update from your wp dashboard, you should consider using add_option or option tree plugin. – тнє Sufi May 9 '14 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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