Quantcast
Channel: Snippets Archives - Gravity Wiz
Viewing all articles
Browse latest Browse all 196

Include Post Permalink in Gravity Forms Confirmation or Notification

$
0
0
View this code snippet on GitHub.

There are two methods for generating a link to a post created by Gravity Forms. Both methods are intended for use in Gravity Forms’ confirmations and notifications (and another other place merge tags are support post-submission).

If you are automatically publishing user submitted posts, this is helpful for providing a link immediately to the user where they can preview their newly created post.

1. Short Link

This method requires no custom code and uses the default {post_id} merge tag.

<a href="http://yoursite.com/?p={post_id}">Post Title</a>

2. Permalink

This method requires some custom code which adds support for the {post_permalink}. The code also makes this merge tag available for selection in the merge tag list

<a href="{post_permalink}">{Post Title:1}</a>

gw-post-permalink

Step by Step

  1. Click the “Download Code” button above. It will open the “raw” code in a new tab.
  2. Select all of the code and copy and paste it into your theme’s functions.php file or as a snippet via a plugin like Code Snippets.
  3. Go to your Confirmation or Notification and select the “Post Permalink” option from the merge tag list (see the screenshot above).

Does this answer your question?

If it doesn’t, let us know in the comments.


Viewing all articles
Browse latest Browse all 196