<?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: Post template condition based on field</title>
		<link>https://legacy.forums.gravityhelp.com/topic/post-template-condition-based-on-field</link>
		<description>Gravity Support Forums Topic: Post template condition based on field</description>
		<language>en-US</language>
		<pubDate>Sun, 05 Apr 2026 06:34:01 +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/post-template-condition-based-on-field" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Post template condition based on field"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/post-template-condition-based-on-field#post-33989</link>
			<pubDate>Wed, 31 Aug 2011 00:38:55 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">33989@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;The post template does not support conditionals like that (for example, if the field is empty, don't print the Source heading.)  I did work up an example recently using the &#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_post_submission&#34; rel=&#34;nofollow&#34;&#62;gform_post_submission&#60;/a&#62; hook:&#60;/p&#62;
&#60;p&#62;Add this code to your theme's functions.php&#60;br /&#62;
&#60;a href=&#34;http://pastebin.com/VverkM3E&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com/VverkM3E&#60;/a&#62;&#60;/p&#62;
&#60;ul&#62;
&#60;li&#62;Change the 9 on line 4 to your form ID.&#60;/li&#62;
&#60;li&#62;Line 7 grabs the post that was just created&#60;/li&#62;
&#60;li&#62;On line 10, the '4' corresponds to the field whose value you want to use as &#34;Source.&#34;  That would be your http field and when it's present (line 10 checks for this), output the &#34;Source: &#34; heading and then the URL after (line 11)&#60;/li&#62;
&#60;li&#62;Line 13 updates the post&#60;/li&#62;
&#60;li&#62;I needed lines 15 - 18 since I needed to clear an image, whether or not there was a Source (http) submitted&#60;/li&#62;
&#60;/ul&#62;
&#60;p&#62;I hope that helps point you in the right direction.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>octavian on "Post template condition based on field"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/post-template-condition-based-on-field#post-33973</link>
			<pubDate>Tue, 30 Aug 2011 20:31:06 +0000</pubDate>
			<dc:creator>octavian</dc:creator>
			<guid isPermaLink="false">33973@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I am pretty sure such an obvious question was answered before, but I was not able to find the right topic.&#60;/p&#62;
&#60;p&#62;Lets say I have an &#34;http&#34; field in my form. I am using post template to make a post and publish it.&#60;br /&#62;
I want to have &#34;Source: -http-&#34; in the post, where -http- is the value of http-field.&#60;/p&#62;
&#60;p&#62;The thing is http field is optional. So there can be no input at all. In such case I would not like to have just &#34;Source: &#34; printed on the page. &#60;/p&#62;
&#60;p&#62;So how it is possible to display or hide code (&#34;source: &#34; in the case) based on whether there is anything in the http-field or not?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
