<?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: Assign default featured image if none input</title>
		<link>https://legacy.forums.gravityhelp.com/topic/assign-default-featured-image-if-none-input</link>
		<description>Gravity Support Forums Topic: Assign default featured image if none input</description>
		<language>en-US</language>
		<pubDate>Sun, 05 Apr 2026 17:17:28 +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/assign-default-featured-image-if-none-input" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Assign default featured image if none input"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/assign-default-featured-image-if-none-input#post-69333</link>
			<pubDate>Fri, 03 Aug 2012 14:05:32 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">69333@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Very good.  Glad you were able to sort that out.  Thank you for the update.   Sorry I could not get back to it until today.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bigtoothmedia on "Assign default featured image if none input"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/assign-default-featured-image-if-none-input#post-69278</link>
			<pubDate>Fri, 03 Aug 2012 07:20:28 +0000</pubDate>
			<dc:creator>bigtoothmedia</dc:creator>
			<guid isPermaLink="false">69278@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Nailed it! Code was (where 1339 is the ID of the default image in my media library):&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;/*********** Set default featured image for reviews submitted via form ************/

// after form 1 is submitted call function
add_filter(&#38;quot;gform_after_submission_1&#38;quot;, &#38;quot;addreview_set_post_thumbnail&#38;quot;);
function addreview_set_post_thumbnail($entry){
	// get post ID of the created post
	$post_id = $entry[&#38;quot;post_id&#38;quot;];
	// get the last image added to the post
	$attachments = get_posts(array(&#38;#39;numberposts&#38;#39; =&#38;gt; &#38;#39;1&#38;#39;, &#38;#39;post_parent&#38;#39; =&#38;gt; $post_id, &#38;#39;post_type&#38;#39; =&#38;gt; &#38;#39;attachment&#38;#39;, &#38;#39;post_mime_type&#38;#39; =&#38;gt; &#38;#39;image&#38;#39;, &#38;#39;order&#38;#39; =&#38;gt; &#38;#39;ASC&#38;#39;));
	//no images attached to the post
	if(sizeof($attachments) == 0){
		// set image as the post thumbnail
		set_post_thumbnail($post_id, 1339);
	}
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>bigtoothmedia on "Assign default featured image if none input"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/assign-default-featured-image-if-none-input#post-69273</link>
			<pubDate>Fri, 03 Aug 2012 04:44:43 +0000</pubDate>
			<dc:creator>bigtoothmedia</dc:creator>
			<guid isPermaLink="false">69273@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Chris, I don't suppose you might be able to have a look at this today could you? Have I got the right idea with the code above?&#60;/p&#62;
&#60;p&#62;Many many thanks again for your help on this...&#60;/p&#62;
&#60;p&#62;Kind regards,&#60;/p&#62;
&#60;p&#62;Cam
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bigtoothmedia on "Assign default featured image if none input"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/assign-default-featured-image-if-none-input#post-68936</link>
			<pubDate>Wed, 01 Aug 2012 08:46:30 +0000</pubDate>
			<dc:creator>bigtoothmedia</dc:creator>
			<guid isPermaLink="false">68936@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Of course, sorry... being stupid! Have I got this right then?&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;/*********** Set default featured image for reviews submitted via form ************/
// after form 1 is submitted call function
add_filter(&#38;quot;gform_after_submission_1&#38;quot;, &#38;quot;gform_set_post_thumbnail&#38;quot;);
function gform_set_post_thumbnail($entry){
// get post ID of the created post
$post_id = $entry[&#38;quot;post_id&#38;quot;];
// get the last image added to the post
$attachments = get_posts(array(&#38;#39;numberposts&#38;#39; =&#38;gt; &#38;#39;1&#38;#39;, &#38;#39;post_parent&#38;#39; =&#38;gt; $post_id, &#38;#39;post_type&#38;#39; =&#38;gt; &#38;#39;attachment&#38;#39;, &#38;#39;post_mime_type&#38;#39; =&#38;gt; &#38;#39;image&#38;#39;, &#38;#39;order&#38;#39; =&#38;gt; &#38;#39;ASC&#38;#39;));
if(sizeof($attachments) == 0)
	return; //no images attached to the post
// set image as the post thumbnail
set_post_thumbnail($post_id, &#38;#39;http://www.clikaclinic.com/images/default-image&#38;#39;);
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Assign default featured image if none input"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/assign-default-featured-image-if-none-input#post-68933</link>
			<pubDate>Wed, 01 Aug 2012 08:33:23 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">68933@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;NEVER modify any of the plugin files.&#60;/p&#62;
&#60;p&#62;You add this code to your theme's functions.php as detailed here:&#60;br /&#62;
&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Where_Do_I_Put_This_Code%3F#PHP&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Where_Do_I_Put_This_Code%3F#PHP&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bigtoothmedia on "Assign default featured image if none input"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/assign-default-featured-image-if-none-input#post-68932</link>
			<pubDate>Wed, 01 Aug 2012 08:32:43 +0000</pubDate>
			<dc:creator>bigtoothmedia</dc:creator>
			<guid isPermaLink="false">68932@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;The default image is:&#60;br /&#62;
&#60;a href=&#34;http://www.clikaclinic.com/images/default-image.jpg&#34; rel=&#34;nofollow&#34;&#62;http://www.clikaclinic.com/images/default-image.jpg&#60;/a&#62;&#60;br /&#62;
It's ID is 1339.&#60;/p&#62;
&#60;p&#62;The form ID is 1.&#60;br /&#62;
I'm not sure where to include this information in the code you pointed me to and also like I say not sure in which file to put the code...&#60;/p&#62;
&#60;p&#62;Sorry! And thanks again for being so helpful :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bigtoothmedia on "Assign default featured image if none input"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/assign-default-featured-image-if-none-input#post-68930</link>
			<pubDate>Wed, 01 Aug 2012 08:23:29 +0000</pubDate>
			<dc:creator>bigtoothmedia</dc:creator>
			<guid isPermaLink="false">68930@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Where should I put the php code then? In the form_display.php file? If so where in that file?&#60;/p&#62;
&#60;p&#62;Sorry for being dumb...
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Assign default featured image if none input"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/assign-default-featured-image-if-none-input#post-68916</link>
			<pubDate>Wed, 01 Aug 2012 07:11:29 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">68916@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;OK, please do let us know how it goes.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bigtoothmedia on "Assign default featured image if none input"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/assign-default-featured-image-if-none-input#post-68913</link>
			<pubDate>Wed, 01 Aug 2012 06:15:33 +0000</pubDate>
			<dc:creator>bigtoothmedia</dc:creator>
			<guid isPermaLink="false">68913@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;That looks extremely helpful thank you so much! I will try it out now and let you know how I get on...
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Assign default featured image if none input"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/assign-default-featured-image-if-none-input#post-68837</link>
			<pubDate>Tue, 31 Jul 2012 17:45:10 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">68837@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;We're accomplishing the same thing, but you would like to do it differently.  The code I posted will supply a default image for a post when there is no featured image, at the time the post is displayed.  You want to store the default image with the post if the user does not submit an image?&#60;/p&#62;
&#60;p&#62;If that's the case, you will have to modify the post after the form is submitted, using the gform_after_submission hook: &#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_after_submission&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Gform_after_submission&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Check the see if the visitor submitted an image to you, and if not, add the code to set a featured image for the post.&#60;/p&#62;
&#60;p&#62;Here is some old code we used to use (prior to 1.6, when the featured image feature was added): &#60;a href=&#34;http://pastie.org/2270372&#34; rel=&#34;nofollow&#34;&#62;http://pastie.org/2270372&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;You're going to want to assign your default image on line 14 I believe.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
