Title: Shortcode email templates
Last modified: February 27, 2023

---

# Shortcode email templates

 *  Resolved [alfredo1216](https://wordpress.org/support/users/alfredo1216/)
 * (@alfredo1216)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/shortcode-email-templates/)
 * Hello,
 * Is it possible to have a shortcode in the email templates that includes the current
   year?
 * ![](https://i0.wp.com/i.ibb.co/nQM8NRs/image.png?ssl=1)
 * Since I have a footer and every year I would have to change it so that it is 
   updated with the current year.
 * Stay tuned to your comments.
 * Greetings,

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [dharmeshbarot](https://wordpress.org/support/users/dharmeshbarot/)
 * (@dharmeshbarot)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/shortcode-email-templates/#post-16512934)
 * Hello [@alfredo1216](https://wordpress.org/support/users/alfredo1216/)
 * Regrettably requested email constant is not a part of our solution. However, 
   you may try the following:
 * The first solution involves manually editing the email template from the “Manage
   Email Templates” section and updating the footer with the current year every 
   year. This is a straightforward solution, and since the footer needs to be updated
   only once a year, it shouldn’t be a significant issue.
 * The second solution involves code customization (Not recommended). You may create
   a new email constant that can be used in email templates to include the current
   year. This solution would require technical expertise, and it may take some time
   to implement. However, once implemented, the solution would automate the process
   of updating the year in the footer of the email templates.
 * If you require any further information, please contact us. 
   Thanks!
 * Team Edwiser
 *  Thread Starter [alfredo1216](https://wordpress.org/support/users/alfredo1216/)
 * (@alfredo1216)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/shortcode-email-templates/#post-16514615)
 * Hello,
 * I understand, and there would be no possibility of integrating it with a shortcode?
   For example I use the following code:
 *     ```wp-block-code
       add_shortcode('current_year', 'get_current_year');
   
       function get_current_year() {
           return date("Y");
       }
       ```
   
 * Which works perfect, but for some reason it doesn’t work in your templates. Any
   idea how I could fix it?
 * However, it would be ideal if they implemented that functionality in a future
   update.
 * Thank you,
 *  [dharmeshbarot](https://wordpress.org/support/users/dharmeshbarot/)
 * (@dharmeshbarot)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/shortcode-email-templates/#post-16517015)
 * Hello [@alfredo1216](https://wordpress.org/support/users/alfredo1216/)
 * It seems you are trying to use a shortcode to insert dynamic content, such as
   the current year, into email templates. However, the constants you mentioned,
   such as USER_NAME and LAST_NAME, are not shortcodes.
 * Here are some points to clarify:
    1. Constants like USER_NAME and LAST_NAME are typically replaced with actual data
       using a find and replace method, rather than through a shortcode.
    2. Unfortunately, it is not possible to implement this functionality via the method
       you suggested using shortcodes.
    3. However, there is a filter hook called `eb_emailtmpl_constants_values` that 
       you can use to manipulate the values of email constants. This filter provides
       all the email templates and their corresponding values.
    4. To use this filter, you can define a function that takes in the `$constants`
       parameter and returns an array of modified values for the constants. This function
       should be defined in the same file where you add the filter hook.
 * I hope this helps! Let me know if you have any further questions.
 * Regarding implementation of this feature in our future plugin update:
 * We have developed a generic solution keeping comprehensive situations in mind
   which the majority of our users experience. And, we avoid adding functionality
   to the core code of our plugins that are not used or requested on a multitude
   of levels by our active users. Because this will be the potential to make a terrible
   impact on the performance of our plugin.
 * We have registered this feature request with our product development team for
   validation. If approved, we will release this feature in our future plugin updates.
 * Thanks,
 * Team Edwiser
 *  Thread Starter [alfredo1216](https://wordpress.org/support/users/alfredo1216/)
 * (@alfredo1216)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/shortcode-email-templates/#post-16518095)
 * Perfect, with the information provided I was able to adjust the code to the mentioned
   Hook and now it works, I show the year automatically in the templates.
 * Thank you very much for your explanation and excellent attention.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Shortcode email templates’ is closed to new replies.

 * ![](https://ps.w.org/edwiser-bridge/assets/icon-128x128.gif?rev=3171309)
 * [Edwiser Bridge – WordPress Moodle Integration](https://wordpress.org/plugins/edwiser-bridge/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/edwiser-bridge/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/edwiser-bridge/)
 * [Active Topics](https://wordpress.org/support/plugin/edwiser-bridge/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/edwiser-bridge/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/edwiser-bridge/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [alfredo1216](https://wordpress.org/support/users/alfredo1216/)
 * Last activity: [3 years, 3 months ago](https://wordpress.org/support/topic/shortcode-email-templates/#post-16518095)
 * Status: resolved