<?xml version="1.0" encoding="UTF-8"?><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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: WordPress Settings API Tutorial</title>
	<atom:link href="http://ottopress.com/2009/wordpress-settings-api-tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://ottopress.com/2009/wordpress-settings-api-tutorial/</link>
	<description>You have to use an Ottopress to get fresh squeezed Otto.</description>
	<lastBuildDate>Wed, 19 Jun 2013 05:25:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6-beta3-24375</generator>
	<item>
		<title>By: Charles Clarkson</title>
		<link>http://ottopress.com/2009/wordpress-settings-api-tutorial/comment-page-2/#comment-11849</link>
		<dc:creator>Charles Clarkson</dc:creator>
		<pubDate>Thu, 30 May 2013 16:59:06 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=39#comment-11849</guid>
		<description><![CDATA[Place it in the functions.php theme (or child theme) file.]]></description>
		<content:encoded><![CDATA[<p>Place it in the functions.php theme (or child theme) file.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bdubb</title>
		<link>http://ottopress.com/2009/wordpress-settings-api-tutorial/comment-page-2/#comment-11848</link>
		<dc:creator>Bdubb</dc:creator>
		<pubDate>Thu, 30 May 2013 09:25:42 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=39#comment-11848</guid>
		<description><![CDATA[Would it be possible to wrap this into a page template and display plugin settings from the front end on a page?]]></description>
		<content:encoded><![CDATA[<p>Would it be possible to wrap this into a page template and display plugin settings from the front end on a page?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Annie</title>
		<link>http://ottopress.com/2009/wordpress-settings-api-tutorial/comment-page-2/#comment-11847</link>
		<dc:creator>Annie</dc:creator>
		<pubDate>Thu, 30 May 2013 07:08:19 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=39#comment-11847</guid>
		<description><![CDATA[Hi,

I am newbie. My basic question is what will be the appropriate location to put the above sample code given? I am not very much familiar with anatomy of wordpress right now. Do I need to create a separate plugin for this or i can put this code in functions.php? Please guide me.

Thanks]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I am newbie. My basic question is what will be the appropriate location to put the above sample code given? I am not very much familiar with anatomy of wordpress right now. Do I need to create a separate plugin for this or i can put this code in functions.php? Please guide me.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christina</title>
		<link>http://ottopress.com/2009/wordpress-settings-api-tutorial/comment-page-2/#comment-11825</link>
		<dc:creator>Christina</dc:creator>
		<pubDate>Thu, 09 May 2013 20:10:05 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=39#comment-11825</guid>
		<description><![CDATA[Sorry, it&#039;s not printing it out.

&lt;code&gt;&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p>Sorry, it&#8217;s not printing it out.</p>
<p><code></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christina</title>
		<link>http://ottopress.com/2009/wordpress-settings-api-tutorial/comment-page-2/#comment-11824</link>
		<dc:creator>Christina</dc:creator>
		<pubDate>Thu, 09 May 2013 20:08:57 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=39#comment-11824</guid>
		<description><![CDATA[I keep getting a &quot;Warning: Illegal string offset &#039;text_string&#039;&quot; error when trying to save the input fields&#039; values.

The database field is appearing but with an empty value. I can&#039;t figure out where you&#039;re getting the &#039;text_string&#039; value in this line:

echo &quot;&quot;;]]></description>
		<content:encoded><![CDATA[<p>I keep getting a &#8220;Warning: Illegal string offset &#8216;text_string&#8217;&#8221; error when trying to save the input fields&#8217; values.</p>
<p>The database field is appearing but with an empty value. I can&#8217;t figure out where you&#8217;re getting the &#8216;text_string&#8217; value in this line:</p>
<p>echo &#8220;&#8221;;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://ottopress.com/2009/wordpress-settings-api-tutorial/comment-page-2/#comment-11799</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Mon, 22 Apr 2013 18:02:10 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=39#comment-11799</guid>
		<description><![CDATA[IRIE! It works now. 

This is my first time building anything for wordpress, forgive the silly mistakes. I&#039;m building my own theme. I have a lot of theme settings to add. Near the end of your tut you outlined a way to add more fields etc. I will have a go at that. 

Check out my partially finished theme dude: http://programming.wecaribbean.net/

Thanks a million. 

Regards,

Mike]]></description>
		<content:encoded><![CDATA[<p>IRIE! It works now. </p>
<p>This is my first time building anything for wordpress, forgive the silly mistakes. I&#8217;m building my own theme. I have a lot of theme settings to add. Near the end of your tut you outlined a way to add more fields etc. I will have a go at that. </p>
<p>Check out my partially finished theme dude: <a href="http://programming.wecaribbean.net/" rel="nofollow">http://programming.wecaribbean.net/</a></p>
<p>Thanks a million. </p>
<p>Regards,</p>
<p>Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Otto</title>
		<link>http://ottopress.com/2009/wordpress-settings-api-tutorial/comment-page-2/#comment-11798</link>
		<dc:creator>Otto</dc:creator>
		<pubDate>Mon, 22 Apr 2013 17:43:17 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=39#comment-11798</guid>
		<description><![CDATA[Yeah, that won&#039;t work either because now you&#039;re not doing anything with the $input variable.

The $input variable contains your new settings. The $options variable contains the old settings. You need to merge the new, validated settings into the $options array and then return that.]]></description>
		<content:encoded><![CDATA[<p>Yeah, that won&#8217;t work either because now you&#8217;re not doing anything with the $input variable.</p>
<p>The $input variable contains your new settings. The $options variable contains the old settings. You need to merge the new, validated settings into the $options array and then return that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://ottopress.com/2009/wordpress-settings-api-tutorial/comment-page-2/#comment-11797</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Mon, 22 Apr 2013 17:41:31 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=39#comment-11797</guid>
		<description><![CDATA[Ok, this is what the entire code looks like. I commented out the validation and returned the array as is, but still no data. Deleted cache and refreshed. So I&#039;m pretty sure I messed it up somewhere. 

&lt;code&gt;
 // add the admin options page
add_action(&#039;admin_menu&#039;, &#039;plugin_admin_add_page&#039;);
function plugin_admin_add_page() {
    add_options_page(&#039;Custom Plugin Page&#039;, &#039;Custom Plugin Menu&#039;, &#039;manage_options&#039;, &#039;plugin&#039;, &#039;plugin_options_page&#039;);
}

// display the admin options page
function plugin_options_page() {
    ?&gt;
    
    My custom plugin
    Options relating to the Custom Plugin.
    
    
    
 
    &lt;input name=&quot;Submit&quot; type=&quot;submit&quot; value=&quot;&quot; /&gt;
    
    &lt;?php
}
 
 // add the admin settings and such
add_action(&#039;admin_init&#039;, &#039;plugin_admin_init&#039;);
function plugin_admin_init(){
    register_setting( &#039;plugin_options&#039;, &#039;plugin_options&#039;, &#039;plugin_options_validate&#039; );
    add_settings_section(&#039;plugin_main&#039;, &#039;Main Settings&#039;, &#039;plugin_section_text&#039;, &#039;plugin&#039;);
    add_settings_field(&#039;plugin_text_string&#039;, &#039;Plugin Text Input&#039;, &#039;plugin_setting_string&#039;, &#039;plugin&#039;, &#039;plugin_main&#039;);
} 
 
function plugin_section_text() {
    echo &#039;Main description of this section here.&#039;;
}
 
function plugin_setting_string() {
    $options = get_option(&#039;plugin_options&#039;);
    echo &quot;&quot;;
}
 
  // validate our options
function plugin_options_validate($input) {
    $options = get_option(&#039;plugin_options&#039;);
    /*
    $options[&#039;text_string&#039;] = trim($input[&#039;text_string&#039;]);
    if(!preg_match(&#039;/^[a-z0-9]{5}$/i&#039;, $options[&#039;text_string&#039;])) {
        $options[&#039;text_string&#039;] = &#039;&#039;;
    }
    */
  return $options;
}
&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p>Ok, this is what the entire code looks like. I commented out the validation and returned the array as is, but still no data. Deleted cache and refreshed. So I&#8217;m pretty sure I messed it up somewhere. </p>
<p><code><br />
 // add the admin options page<br />
add_action('admin_menu', 'plugin_admin_add_page');<br />
function plugin_admin_add_page() {<br />
    add_options_page('Custom Plugin Page', 'Custom Plugin Menu', 'manage_options', 'plugin', 'plugin_options_page');<br />
}</p>
<p>// display the admin options page<br />
function plugin_options_page() {<br />
    ?&gt;</p>
<p>    My custom plugin<br />
    Options relating to the Custom Plugin.</p>
<p>    &lt;input name=&quot;Submit&quot; type=&quot;submit&quot; value=&quot;" /&gt;</p>
<p>    &lt;?php<br />
}</p>
<p> // add the admin settings and such<br />
add_action(&#039;admin_init&#039;, &#039;plugin_admin_init&#039;);<br />
function plugin_admin_init(){<br />
    register_setting( &#039;plugin_options&#039;, &#039;plugin_options&#039;, &#039;plugin_options_validate&#039; );<br />
    add_settings_section(&#039;plugin_main&#039;, &#039;Main Settings&#039;, &#039;plugin_section_text&#039;, &#039;plugin&#039;);<br />
    add_settings_field(&#039;plugin_text_string&#039;, &#039;Plugin Text Input&#039;, &#039;plugin_setting_string&#039;, &#039;plugin&#039;, &#039;plugin_main&#039;);<br />
} </p>
<p>function plugin_section_text() {<br />
    echo &#039;Main description of this section here.';<br />
}</p>
<p>function plugin_setting_string() {<br />
    $options = get_option('plugin_options');<br />
    echo "";<br />
}</p>
<p>  // validate our options<br />
function plugin_options_validate($input) {<br />
    $options = get_option('plugin_options');<br />
    /*<br />
    $options['text_string'] = trim($input['text_string']);<br />
    if(!preg_match('/^[a-z0-9]{5}$/i', $options['text_string'])) {<br />
        $options['text_string'] = '';<br />
    }<br />
    */<br />
  return $options;<br />
}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Otto</title>
		<link>http://ottopress.com/2009/wordpress-settings-api-tutorial/comment-page-2/#comment-11796</link>
		<dc:creator>Otto</dc:creator>
		<pubDate>Mon, 22 Apr 2013 16:59:44 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=39#comment-11796</guid>
		<description><![CDATA[Okay, well, that example validation code rejects any text that is not a 32-character long alphanumeric. You need to write your own validation code, to validate to what you expect the input to actually be.]]></description>
		<content:encoded><![CDATA[<p>Okay, well, that example validation code rejects any text that is not a 32-character long alphanumeric. You need to write your own validation code, to validate to what you expect the input to actually be.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://ottopress.com/2009/wordpress-settings-api-tutorial/comment-page-2/#comment-11795</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Mon, 22 Apr 2013 16:54:13 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=39#comment-11795</guid>
		<description><![CDATA[I copied it from above, but here it is:

&lt;code&gt;
function plugin_options_validate($input) {
$options = get_option(&#039;plugin_options&#039;);
$options[&#039;text_string&#039;] = trim($input[&#039;text_string&#039;]);
if(!preg_match(&#039;/^[a-z0-9]{32}$/i&#039;, $options[&#039;text_string&#039;])) {
$options[&#039;text_string&#039;] = &#039;&#039;;
}
return $options;
}&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p>I copied it from above, but here it is:</p>
<p><code><br />
function plugin_options_validate($input) {<br />
$options = get_option('plugin_options');<br />
$options['text_string'] = trim($input['text_string']);<br />
if(!preg_match('/^[a-z0-9]{32}$/i', $options['text_string'])) {<br />
$options['text_string'] = '';<br />
}<br />
return $options;<br />
}</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Object Caching 403/420 objects using xcache

 Served from: ottodestruct.com @ 2013-06-19 01:55:05 by W3 Total Cache -->