<?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: Setting page template in functions.php</title>
		<link>https://legacy.forums.gravityhelp.com/topic/setting-page-template-in-functionsphp</link>
		<description>Gravity Support Forums Topic: Setting page template in functions.php</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 01:02:21 +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/setting-page-template-in-functionsphp" rel="self" type="application/rss+xml" />

		<item>
			<title>dannybull on "Setting page template in functions.php"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/setting-page-template-in-functionsphp#post-11912</link>
			<pubDate>Mon, 01 Nov 2010 18:37:41 +0000</pubDate>
			<dc:creator>dannybull</dc:creator>
			<guid isPermaLink="false">11912@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Cheers David. I had to edit your code slightly to the following to get it working:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$post_data[&#38;quot;post_custom_fields&#38;quot;] = array(
       	&#38;quot;_wp_page_template&#38;quot; =&#38;gt; &#38;quot;recipe.php&#38;quot;
);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Thanks for your help.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Smith on "Setting page template in functions.php"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/setting-page-template-in-functionsphp#post-11904</link>
			<pubDate>Mon, 01 Nov 2010 16:23:24 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">11904@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Danny,&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://pastie.org/1264896&#34; rel=&#34;nofollow&#34;&#62;http://pastie.org/1264896&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I update your script with this snippet:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$post_data[&#38;quot;post_custom_fields&#38;quot;][] = array(
        &#38;quot;meta_name&#38;quot; =&#38;gt; &#38;quot;_wp_page_template&#38;quot;,
        &#38;quot;meta_value&#38;quot; =&#38;gt; &#38;quot;page_custom.php&#38;quot;
        );&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;In WordPress the page template is stored as a custom field per page. To update this when the post is created, we simply append a new custom field to the post data using WP's expected page template custom field for the meta name and the filename of your page template for the meta value.&#60;/p&#62;
&#60;p&#62;Hope this helps! :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>dannybull on "Setting page template in functions.php"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/setting-page-template-in-functionsphp#post-11849</link>
			<pubDate>Sun, 31 Oct 2010 18:11:30 +0000</pubDate>
			<dc:creator>dannybull</dc:creator>
			<guid isPermaLink="false">11849@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;We're successfully using Gravity forms to create a post that is converted into a page within functions.php. We're also changing the parent page based on a selection made in the form. Here's the code we're using:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_post_data&#38;quot;, &#38;quot;change_post_type&#38;quot;, 10, 2);
function change_post_type($post_data, $form){
    //only change post type on form id X
    if($form[&#38;quot;id&#38;quot;] != 1)
       return $post_data;

	   //add other page data here
	   $post_data[&#38;quot;post_type&#38;quot;] = &#38;quot;page&#38;quot;;
	   $post_data[&#38;quot;post_parent&#38;quot;] = $_POST[&#38;quot;input_8&#38;quot;]; // Parent page is pulled from drop down on form
    return $post_data;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;What we'd like to do next is change the page template in the above function. Does anyone know if this is possible?&#60;/p&#62;
&#60;p&#62;Many thanks.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
