<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WP Engineer &#187; options</title>
	<atom:link href="http://wpengineer.com/tag/options/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpengineer.com</link>
	<description>WordPress News, Hacks, Tips, Tutorials, Plugins and Themes</description>
	<lastBuildDate>Mon, 21 May 2012 22:48:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WordPress: Useful Default Configuration Settings Via Plugin</title>
		<link>http://wpengineer.com/1957/wordpress-useful-default-configuration-settings-via-plugin/</link>
		<comments>http://wpengineer.com/1957/wordpress-useful-default-configuration-settings-via-plugin/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 11:24:41 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[options]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1957</guid>
		<description><![CDATA[Everybody who installs WordPress quite often knows the problem: You always have to do the same adjustments, for example deleting the Hello World post. That cost time and money. Our friend Thomas Scholz alias toscho had a simple but genius idea, he puts all needed option settings in a Plugin. Just activate the Plugin, deactivate [...]]]></description>
			<content:encoded><![CDATA[<p>Everybody who installs WordPress quite often knows the problem: You always have to do the same adjustments, for example deleting the Hello World post. That cost time and money. Our friend <a href="http://toscho.de/" title="Toscho Design">Thomas Scholz</a> alias toscho had a simple but genius idea, he puts all needed option settings in a Plugin. Just activate the Plugin, deactivate it and delete it. Done!</p>
<p>You can adjust and expand the options as you like. A good overview is the wp-admin/options.php.</p>
<pre lang="php">
&lt;?php
/*
Plugin Name: Toscho&#039;s basic settings
Plugin URI: http://toscho.de/2010/wordpress-grundeinstellungen-per-plugin-setzen/
Description: Some useful default configuration settings. See &#039;wp-admin/options.php&#039; for more options.
Version: 0.2
Author: Thomas Scholz
Author URI: http://toscho.de
*/

function set_toscho_defaults()
{
    $o = array(
        &#039;avatar_default&#039;            =&gt; &#039;blank&#039;,
        &#039;avatar_rating&#039;             =&gt; &#039;G&#039;,
        &#039;category_base&#039;             =&gt; &#039;/thema&#039;,
        &#039;comment_max_links&#039;         =&gt; 0,
        &#039;comments_per_page&#039;         =&gt; 0,
        &#039;date_format&#039;               =&gt; &#039;d.m.Y&#039;,
        &#039;default_ping_status&#039;       =&gt; &#039;closed&#039;,
        &#039;default_post_edit_rows&#039;    =&gt; 30,
        &#039;links_updated_date_format&#039; =&gt; &#039;j. F Y, H:i&#039;,
        &#039;permalink_structure&#039;       =&gt; &#039;/%year%/%postname%/&#039;,
        &#039;rss_language&#039;              =&gt; &#039;de&#039;,
        &#039;timezone_string&#039;           =&gt; &#039;Etc/GMT-1&#039;,
        &#039;use_smilies&#039;               =&gt; 0,
    );

    foreach ( $o as $k =&gt; $v )
    {
        update_option($k, $v);
    }

    // Delete dummy post and comment.
    wp_delete_post(1, TRUE);
    wp_delete_comment(1);

    return;
}
register_activation_hook(__FILE__, &#039;set_toscho_defaults&#039;);
?&gt;
</pre>
<p>Here you can <a href="http://f.toscho.de/php-skripte/toscho_basic_settings-0.2.zip" title="Download toschos plugin">download</a> the Plugin by toscho.</p>
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/1957/wordpress-useful-default-configuration-settings-via-plugin/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Quick View on WordPress Settings</title>
		<link>http://wpengineer.com/1867/quick-view-on-wordpress-settings/</link>
		<comments>http://wpengineer.com/1867/quick-view-on-wordpress-settings/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 06:50:56 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Advent Calendar]]></category>
		<category><![CDATA[backend]]></category>
		<category><![CDATA[options]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1867</guid>
		<description><![CDATA[In all versions of WordPress, there is the possibility to view all settings within the admin area of WordPress, but a menu link doesn't exist. The page options.php enables to have a quick look at various options and also allows you to save settings. However, it must be said, WordPress stores more data in serialized [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpengineer.com/wp-content/uploads/WordPress-Christmas-21.jpg" alt="WordPress-Christmas-18" title="WordPress-Christmas-18" width="600" height="400" class="aligncenter size-full wp-image-1896" />In all versions of WordPress, there is the possibility to view all settings within the admin area of WordPress, but a menu link doesn't exist. The page <code>options.php</code> enables to have a quick look at various options and also allows you to save settings.<br />
However, it must be said, WordPress stores more data in serialized form, which also is a good thing, but those you can no longer edit on this page.</p>
<p><img src="http://wpengineer.com/wp-content/uploads/wp-options.png" alt="wp-options" title="wp-admin/options.php" width="450" height="365" class="aligncenter size-full wp-image-1868" /></p>
<p>Nonetheless, certainly worth a look and now and then a help to quickly look into the settings of the blog. Alternatively, the plugin <a href="http://wordpress.org/extend/plugins/wp-developer-assistant/">WP Developer Assistant</a> can help here, because it also allows a glimpse into the serialized data.</p>
<p>Example-URL: http://example.com/wp-admin/options.php</p>
<p>Alternatively you can also add a menu link. Add the following snippet in to the <code>functions.php</code> of your theme or create a Plugin.</p>
<pre lang="php">
function all_settings_page() {
	add_options_page( __( &#039;All Settings&#039; ), __( &#039;All Settings&#039; ), &#039;administrator&#039;, &#039;options.php&#039; );
}
add_action( &#039;admin_menu&#039;, &#039;all_settings_page&#039; );
</pre>
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/1867/quick-view-on-wordpress-settings/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WordPress: Working With Options</title>
		<link>http://wpengineer.com/968/wordpress-working-with-options/</link>
		<comments>http://wpengineer.com/968/wordpress-working-with-options/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 11:20:14 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[options]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=968</guid>
		<description><![CDATA[Options in WordPress are in an extra options table (with Prefix before) stored. Options include the blog name, which theme is used, etc.. Plugins define their settings as options. A simple example of how options can be accessed: echo get_option(&#039;blogname&#039;); This snippet is the blog name. In order to use its own options, they must [...]]]></description>
			<content:encoded><![CDATA[<p>Options in WordPress are in an extra <strong>options</strong> table (with Prefix before) stored. Options include the blog name, which theme is used, etc.. Plugins define their settings as options. A simple example of how options can be accessed:</p>
<p><span id="more-968"></span></p>
<pre lang="php">
echo get_option(&#039;blogname&#039;);
</pre>
<p>This snippet is the blog name. In order to use its own options, they must be created first:</p>
<pre lang="php">
add_option(&#039;myOptions&#039;, &#039;a Test&#039;);
</pre>
<p>This call writes a new entry myOptions with the value "a Test" in the database. If you have more data to store, you do not have to write every option in a new row of the database table. Taking the data in an array provides a lot faster access.</p>
<pre lang="php">
$myOptions = array(
	&#039;firstOption&#039; =&gt; 1,
	&#039;secondOption&#039; =&gt; &#039;second&#039;
);
add_option(&#039;myOptions&#039;, $myOptions);
</pre>
<p>In the database it looks like this:</p>
<pre lang="php">
a:2:{s:11:&quot;firstOption&quot;;i:1;s:12:&quot;secondOption&quot;;s:6:&quot;second&quot;;}
</pre>
<p>Here you can see the data type very nicely. a: is for array, s: for a string and i: for an integer.<br />
To overwrite the options, you use update_option().</p>
<pre lang="php">
$myNewOptions = array(
	&#039;firstOption&#039; =&gt; 2,
	&#039;secondOption&#039; =&gt; &#039;my second Option&#039;
);
update_option(&#039;myOptions&#039;, $myNewOptions);
</pre>
<p>Now you can work with the stored options.</p>
<pre lang="php">
$myOptions = get_option(&#039;MyOptions&#039;);
foreach($myOptions as $option =&gt; $value) {
	echo $option . &quot; =&gt; &quot; . $value . &quot;&lt;br /&gt;&quot;;
}
/* Output:
firstOption =&gt; 2
secondOption =&gt; my second Option
*/

echo $myOptions&#091;&#039;firstOption&#039;&#093;;
/* Output:
2
*/
</pre>
<p>Options of a plugin or theme should be also deleted if you uninstall them. You delete the options with delete_option.</p>
<pre lang="php">
delete_option(&#039;myOptions&#039;);
</pre>
<p>You also can display something depending on the options, if option is 0, do this, if it's 1 do this.</p>
<p>In my theme, which I'm working on right now, I have over 130 options now. It's not very easy to program, if you must access nested arrays.</p>
<pre lang="php">
$myOptions = get_option(&#039;MyOptions&#039;);
echo $myOptions&#091;&#039;first&#039;&#093;&#091;&#039;foo&#039;&#093;&#091;&#039;bar&#039;&#093;&#091;&#039;name&#093;;
</pre>
<p>A really cool alternative is to write the options as an object in the database:</p>
<pre lang="php">
$myOptions = new stdClass();
$myOptions-&gt;name = &quot;myOption&quot;;
$myOptions-&gt;params-&gt;param1 = 1;
$myOptions-&gt;params-&gt;param2 = &#039;second parameter&#039;;
update_option(&#039;myOptions&#039;, $myOptions);
</pre>
<p>In our database is now our serialized Object:</p>
<pre lang="php">
O:8:&quot;stdClass&quot;:2:{s:4:&quot;name&quot;;s:8:&quot;myOption&quot;;s:6:&quot;params&quot;;O:8:&quot;stdClass&quot;:2:{s:6:&quot;param1&quot;;i:1;s:6:&quot;param2&quot;;s:16:&quot;second parameter&quot;;}}
</pre>
<p>After you grab the options from your database, they are available as object.</p>
<pre lang="php">
$myOptions = get_option(&#039;MyOptions&#039;);
echo $myOptions-&gt;name;
/* Output:
myOption
*/

echo $myOptions-&gt;params-&gt;param2;
/* Output:
second parameter
*/
</pre>
<p>What do you do now with the acquired knowledge? I do not know, use your creativity and leave your ideas in the comment section!</p>
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/968/wordpress-working-with-options/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>

