PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

PHP block

  1. paddelboot
    Member

    It would be very useful to have a "PHP block" kind of field. I constantly need to display the content of some PHP string in between the form fields.

    Paddelboot

    Posted 11 years ago on Wednesday July 18, 2012 | Permalink
  2. I've run across that too. To work around it, because shortcodes will be processed in the HTML block, I usually create a shortcode in my functions.php or a plugin file, and write the PHP function there. Then you can insert the shortcode in the HTML block in your Gravity Form. It will work the same way.

    Posted 11 years ago on Wednesday July 18, 2012 | Permalink
  3. paddelboot
    Member

    Sounds good, I didn't know shortcodes where enabled. But it probably means you'll have to register a shortcode for each individual block, right?

    Posted 11 years ago on Wednesday July 18, 2012 | Permalink
  4. No, you don't have to register them for each hook. Shortcodes are processed in the HTML block. You don't need to do anything special at all. Just create your shortcode function and then use the shortcode and you'll be good to go.

    I started doing that a long time ago when website owners wanted to use PHP in their posts, and I was not comfortable using the PHP Exec plugin to allow that. Not to mention, the visual editor messes the PHP tags up. So, I create the shortcode and let them use that. It works really well.

    Posted 11 years ago on Wednesday July 18, 2012 | Permalink