<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Enqueuing scripts for custom content area</title>
		<link>https://legacy.forums.gravityhelp.com/topic/enqueuing-scripts-for-custom-content-area</link>
		<description>Gravity Support Forums Topic: Enqueuing scripts for custom content area</description>
		<language>en-US</language>
		<pubDate>Thu, 16 Apr 2026 08:32:12 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/enqueuing-scripts-for-custom-content-area" rel="self" type="application/rss+xml" />

		<item>
			<title>David Smith on "Enqueuing scripts for custom content area"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/enqueuing-scripts-for-custom-content-area#post-34089</link>
			<pubDate>Wed, 31 Aug 2011 18:19:47 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">34089@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Steve,&#60;/p&#62;
&#60;p&#62;After a certain point, I do not believe it is possible to enqueue a script, even with the $in_footer flag set to true. Feel free to correct me on this if you have a method that works.&#60;/p&#62;
&#60;p&#62;In regards to the print_form_scripts() function, you can do this a couple ways. &#60;/p&#62;
&#60;p&#62;1) Print the scripts inline with the Gravity Form wherever the shortcode is found.&#60;br /&#62;
2) Similarly to your own idea, set a flag if the scripts need to be loaded, then add a hook in the footer to user the print_form_scripts() function that checks the flag and if true, prints the scripts in the footer.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Steve.Taylor on "Enqueuing scripts for custom content area"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/enqueuing-scripts-for-custom-content-area#post-34086</link>
			<pubDate>Wed, 31 Aug 2011 17:43:30 +0000</pubDate>
			<dc:creator>Steve.Taylor</dc:creator>
			<guid isPermaLink="false">34086@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Why can't you have a filter on &#60;code&#62;the_content&#60;/code&#62; which would then enqueue with the &#60;code&#62;$in_footer&#60;/code&#62; parameter set to &#60;code&#62;true&#60;/code&#62;? Then, if some content with a Gform shortcode is placed somewhere after the header has rendered, the scripts would go in the footer.&#60;/p&#62;
&#60;p&#62;Regarding &#60;code&#62;GFFormDisplay::print_form_scripts&#60;/code&#62; (line 1175?), do you mean to print the scripts inside the &#60;code&#62;&#38;lt;body&#38;gt;&#60;/code&#62; when &#60;code&#62;the_content&#60;/code&#62; filter is run? Or to set a flag in &#60;code&#62;the_content&#60;/code&#62;, and then print scripts in the footer if the flag is set?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Smith on "Enqueuing scripts for custom content area"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/enqueuing-scripts-for-custom-content-area#post-34064</link>
			<pubDate>Wed, 31 Aug 2011 16:26:54 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">34064@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Steve,&#60;/p&#62;
&#60;p&#62;The problem is &#34;the_content&#34; fires way too late for enqueueing scripts/styles. Enqueueing styles needs to happen before the header is rendered.&#60;/p&#62;
&#60;p&#62;What you can do is print the scripts using the GFFormDisplay::print_form_scripts($form, $ajax); function. For more details, take a look form_display.php circa line 700.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Steve.Taylor on "Enqueuing scripts for custom content area"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/enqueuing-scripts-for-custom-content-area#post-34046</link>
			<pubDate>Wed, 31 Aug 2011 15:34:42 +0000</pubDate>
			<dc:creator>Steve.Taylor</dc:creator>
			<guid isPermaLink="false">34046@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I'm using some custom meta boxes with TinyMCE fields to let the client edit separate tabs on a page. When they embed a Gravity Form in one of these fields, the necessary scripts don't get enqueued.&#60;/p&#62;
&#60;p&#62;It looks like this is because &#60;code&#62;GFFormDisplay::enqueue_scripts&#60;/code&#62; looks through the current WP query content for forms. I'm wondering, might it be possible for Gravity Forms to scan for forms using the &#60;code&#62;the_content&#60;/code&#62; filter? I output all my custom TinyMCE fields with this filter, so presumably the forms would be detected, and the scripts would go in the footer.&#60;/p&#62;
&#60;p&#62;Meantime, could you help me with a hack? I've tried this in my theme's functions.php:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter( &#38;#39;the_content&#38;#39;, &#38;#39;slt_enqueue_gforms_scripts&#38;#39; );
function slt_enqueue_gforms_scripts( $content ) {
	$forms = GFFormDisplay::get_embedded_forms( $content, $ajax );
	foreach( $forms as $form)
		GFFormDisplay::enqueue_form_scripts( $form, $ajax );
	return $content;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;However, it seems that &#60;code&#62;enqueue_scripts&#60;/code&#62; can't call &#60;code&#62;get_embedded_forms&#60;/code&#62;, because the latter is a private method. Any way to do this?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
