Add A Date To Push Notifications

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 the functions.php file for your theme (learn how to locate that file here). As this is very important file, be careful when you are editing this file.  You can access this 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 how 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]

Feedback and Knowledge Base