• Home
  • Pricing
  • Free Resources
  • About
  • Docs
  • Support
  • Account

Gravity Wiz

Magically enhanced tutorials, snippets and plugins for Gravity Forms!

  • Gravity Perks
    • Gravity Perks
    • Pricing
  • Blog
    • Free Resources
    • About
  • Support
    • Docs
    • Support
    • Account

Create Dynamic Post Excerpts with Gravity Forms

Last updated March 17, 2021 | Written by David Smith 14 Comments

Gravity Forms provides an awesome option to create a “Content Template” for the Post Title and Post Body fields; however, the lowly Post Excerpt feel does not have this option.

Here’s a quick snippet which allows you to create your own content template for the Post Excerpt of any post created by a Gravity Form.

View CodeDownload Code

Filed Under: Uncategorized post creation quick & dirty

Comments

  1. Jeff Turner says

    February 16, 2017 at 10:51 pm

    Is there a way to add html or css in the excerpt template….trying to replicate the way a byline looks in the content section (using the built in content template available in the content field) Just need to increase text size and/or color for “by {merge code first name} {merge code last name}, {merge code position}, then just leave {merge code body copy} as normal text?

    Reply
    • David Smith says

      February 19, 2017 at 8:26 am

      Hi Jeff, I think you’ll need to use this snippet: https://gist.github.com/spivurno/b5c7af4635b781c5bdf9

  2. Jake says

    December 16, 2016 at 7:09 am

    Hi David,

    This is fantastic – thank you for this bit of code. It would be great if $excerpt_template picked up field values instead of field labels.

    Reply
    • David Smith says

      December 19, 2016 at 9:06 pm

      Are you using a choice-based field? If so, you can use the “:value” modifier. Example: {My Field:1:value}.

  3. Sunit says

    December 16, 2016 at 12:48 am

    Hi David,

    Will the snippet also work for custom post type, say the product short description of a Woocommerce product using your plugin Gravity Forms + Custom Post Types?

    Reply
    • David Smith says

      December 19, 2016 at 9:06 pm

      Yes, sir. :)

  4. Brett says

    July 17, 2016 at 12:30 pm

    I am using this, and it is working great… however I have not found a way to include a line break in the post excerpt.

    Any suggestions?

    Reply
    • David Smith says

      August 8, 2016 at 12:30 pm

      I tested with Twenty Sixteen and line breaks in the Post Excerpt worked as expected. Sounds like it may be a theme issue.

  5. grace says

    January 3, 2016 at 1:47 pm

    What do the 10,3 digits refer to ?

    Reply
    • David Smith says

      March 14, 2016 at 8:27 pm

      Hi Grace, 10 is the priority that our function should be run in compared to all other functions bound to this same action. 3 refers to the number of parameters that should be passed to our function. This is limited by the number of parameters specified wherever the action/filter is called in the source code.

  6. Lauren says

    February 5, 2015 at 7:10 pm

    Hey David!

    I’m SO excited to find this snippet, as I’ve been searching for a way to use merge tags in excerpts. I put this snippet in the functions.php file and changed the ID to the ID of my form, but nothing seems to have changed. Where should I insert this snippet?

    Thank you for all your great work!

    Lauren

    Reply
    • David Smith says

      February 6, 2015 at 7:05 am

      Hi Lauren, can you confirm this was placed in your theme’s functions.php file? I’ve seen some folks accidentally put this in */wp-includes/functions.php** which won’t work. If you’re sure you put it in the right file, could you send me a URL to your form and a pastie with the contents of your functions.php file?

  7. Gil Namur says

    January 27, 2015 at 11:23 pm

    Hi David,

    This works perfectly. Thank you so much for this!

    I also want to take a moment to let any of your readers know that you have been an excellent resource to me recently.

    I recently had you do some work for me and your approach was very professional and your communications were succinct, timely and courteous. You are a breath of fresh air.

    Let the reader understand that I would never hesitate to use David for any GF coding that I need and encourage you to do likewise. You will not be disappointed!

    Thanks again David!

    Cheers,

    Gil Namur President & CEO Life As A Human Inc.

    Reply
    • David Smith says

      January 27, 2015 at 11:25 pm

      Thanks for the kinds words, Gil. It was a pleasure working with you as well!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.

Recent Posts

  • Our 46th perk is here. Say hello to Advanced Save & Continue.
  • Introducing Page Transitions 1.0 ๐Ÿ“–
  • Gravity Forms QR Code turns 1.0 ๐ŸŽ‰
  • How to Filter One Field By Another and Create Gravity Forms Chained Selects
  • Gravity Forms OpenAI

Categories

  • How To (78)
  • News (25)
  • Plugins (21)
  • Releases (19)
  • Resource (4)
  • Snippets (54)
  • Spotlights (18)
  • Tutorials (58)
  • Updates (177)

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 2023 ยท Powered by WordPress ยท Gravity Wiz LLC

  • Support
  • Affiliates
  • About
  • Sitemap
  • Terms & Conditions of Use
  • Privacy Policy
  • Cookies Policy