After a user signs up to receive newsletters (using the profile coming from CiviCRM/CiviMail), they receive a confirmation email. Upon clicking on the confirmation link in that email, they are taken to a Confirmation page which says that they have successfully been subscribed to the X mailing list. The content of that Confirmation page comes from the /civicrm/templates/CRM/Mailing/Page/Confirm.tpl.

What I need to do is one of the following. Either of these options would work for me:
1) Run php code in the Confirm.tpl file. This would allow me to dynamically load some additional content and present it to the user. I'm not sure about the possibility of this because I know inserting php in Smarty has been deprecated.
2) Redirect to a separate page and present to the user that page instead of the content coming from Confirm.tpl. In that separate page I would then be able to run my php and load content dynamically.

I am running Wordpress 4.4 and CiviCRM 4.6.8.

2 Answers 2


Have you looked at adding a .tpl.extra file? This can be a very easy way to add more content to any template.

Instructions are here.

Your .tpl.extra file could contain either the extra content you wish, or one line of javascript to perform the redirect.


I settled on using a Wordpress shortcode. The shortcode gets evaluated by Wordpress so practically it's the same as running some php. I put the shortcode in Civi's .tpl file.

Some additional information: the first time I tried inserting a shortcode in a .tpl file, it didn't work. I tried it on a contribution page. But the contribution page itself is loaded through a shortcode, so in effect we would have a shortcode inside a shortcode, which didn't work. After that I tried inserting a shortcode in the /civicrm/templates/CRM/Mailing/Page/Confirm.tpl and it worked. I think it's because the CiviCRM page in Wordpress is loaded by a hook, not by a shortcode.

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.