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.

Adding a Gravity Form in a custom field

  1. Hi, I'd like to use the shortcode to embed a Gravity Form in a custom field.

    The form displays fine on the published page, but the associated CSS and Javascript files are not pulled in. I could do this manually. But I am wondering what the right way to do this is.

    Thanks.

    Posted 10 years ago on Tuesday November 15, 2011 | Permalink
  2. Since I posted my question, I found this:
    http://www.gravityhelp.com/documentation/page/Gravity_form_enqueue_scripts

    I will look to do this. I am wondering, though, if you'd consider adding this feature automatically. That is, since the form displays fine, could the CSS and scripts be enqueued automatically when embedding a form this way?

    Posted 10 years ago on Tuesday November 15, 2011 | Permalink
  3. If the scripts aren't being enqueued automatically this means where you have implemented the shortcode or function call to display a form can't automatically do it. In that case you have to use the enqueue function that you linked to which can handle enqueuing the necessary scripts and CSS from your themes functions.php file.

    It's not something we can "add". It's a limitation of WordPress and how and when you can enqueue scripts. You can only automatically do it from certain points the WordPress page execution cycle. This is primarily only from the post content in the main loop. Outside of that, it can't be done automatically without doing it inline. So the enqueue function is there so you can place it somewhere where the scripts can be enqueued.

    Posted 10 years ago on Tuesday November 15, 2011 | Permalink