When sending out a Push Notification (read this article to learn more about Push Notifications) you might want to add the date that the email was sent, especially if your Push Notification is serving as any type of a receipt.

To do this, follow the steps below:

  • Locate and open your theme's functions.php file.  As this is very important file, be careful when you are making any changes. We would also suggest copying the original file contents and saving them just in case. You can edit this file one of two ways:

    1. Open the functions.php file for your theme in an editor (stored in your current theme folder wp-content/theme).

    2. Access the file from Dashboard > Appearance > Editor; make sure your theme is selected, then click functions.php in the list on the right.  

    If you would like more help on what/how to edit this file, please read this article.

  • Add the following code to the file:

    function ng_date_shortcode($atts, $content = null) {
    return ($content) ? date($content) : date("F d, Y");
    }
    add_shortcode('curr_date', 'ng_date_shortcode');

  • Then you can use the shortcode anywhere on your site, including in push notifications:

    [curr_date]