How to add post articles to your Gravity Forms email notifications

August 2, 2019 by JetSloth

Ever wanted to add your latest blog articles and posts to an email autoresponder in Gravity forms? We’ll with the below handy little snippet, you can inject your 4 latest blog articles into any default or custom Gravity Forms notification.

Try the live example

  • See example

    Enter your email and we'll send you what the example looks like in your mailbox.
  • This field is for validation purposes and should be left unchanged.

Creating short-code

Add the below code snippet to your functions.php file. This snippet registers the shortcode in WordPress and creates the HTML markup that injects your latest posts into a table.

Add the shortcode

Now you’ve created the shortcode to output the 4 latest blog articles, all you need to do is add the following shortcode [email_latest_posts] to any of your Gravity Forms notification emails.

In the example above, I’ve created a custom HTML email, and added the shortcode to it, as below.

Gravity Forms custom short code in emails

The result

The HTML email when sent will render the latest posts and add them into your email like below.

Gravity Forms custom short code in emails

That’s it!

Pretty simple hey? Just add the code snippet to your functions file and you can start adding the shortcode where ever you like!

Make sure to leave a comment below and let us know what you think!