<?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>birghtyoursite &#187; wordpress plugin</title>
	<atom:link href="http://www.brightyoursite.com/blog/tag/wordpress-plugin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brightyoursite.com/blog</link>
	<description>Bright your site</description>
	<lastBuildDate>Mon, 19 Dec 2011 09:39:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>add theme options for your wordpress theme</title>
		<link>http://www.brightyoursite.com/blog/2010/02/10/add-theme-options-for-your-wordpress-theme/</link>
		<comments>http://www.brightyoursite.com/blog/2010/02/10/add-theme-options-for-your-wordpress-theme/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 13:33:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[wordpress plugin]]></category>

		<guid isPermaLink="false">http://www.brightyoursite.com/blog/?p=236</guid>
		<description><![CDATA[What&#8217;s this can do ? Are you want to add featured posts , easy to manage the ads on your wordpress site or show a special category posts on your home page ? Add theme options for your wordpress theme ,you will know it&#8217;s so easy !!! Prepare First , we should know two important [...]]]></description>
			<content:encoded><![CDATA[<h3>What&#8217;s this can do ?</h3>
<p>
Are you want to add featured posts ,  easy to manage the ads on your wordpress site  or show a  special category posts on your home page ? Add  theme options for your wordpress theme ,you will know  it&#8217;s so easy !!!
</p>
<p><span id="more-236"></span></p>
<h3>Prepare</h3>
<p>
First , we  should know two important wordpress tags : <b>add_theme_page</b> , <b>add_action </b> and two wordpress api : <b>update_option</b> , <b>delete_option</b>
</p>
<p>
<b>add_theme_page</b> : add_theme_page( page_title, menu_title, capability, handle, [function]); </p>
<dl>
<dt>page_title</dt>
<dd>Set the page title of the options page </dd>
<dt>menu_title</dt>
<dd>The anchor text of the menu .</dd>
<dt>capability</dt>
<dd>The minimum <a title="Roles and Capabilities" href="http://codex.wordpress.org//Roles_and_Capabilities">capability</a> required to display and use this menu page. Go to wordpress <a title="Roles and Capabilities" href="http://codex.wordpress.org//Roles_and_Capabilities">capability</a> page for more details .
</dd>
<dt>handle/file</dt>
<dd>If the function parameter is omitted, this should be the PHP file that handles the display of the menu page content. Otherwise, and more commonly, it will be a unique &#8220;handle&#8221; for the page. e.g. &#8220;my-awesome-plugin-settings&#8221;</dd>
<dt>function</dt>
<dd>The function that displays the options  page content for the menu page.</dd>
</dl>
<p><b>add_action </b>: add_action( $tag, $function_to_add, $priority, $accepted_args );<br/> </p>
<dl>
<dt>$tag</dt>
<dd>(required) The name of the action you wish to hook onto ,check <a title="Plugin API/Action Reference" href="http://codex.wordpress.org//Plugin_API/Action_Reference">Plugin API/Action Reference</a> for the action list .</dd>
<dt>$function_to_add</dt>
<dd>(required) The name of the function you wish to be called .</dd>
<dt>$priority</dt>
<dd>(optional) Default: 10 this define the function execute  order , lower number first . eg. if a function set priority to 5 that&#8217;s means this function run earlier than which priority is 10 </dd>
<dt>$accepted_args</dt>
<dd>(optional) Default: 1 This define the arguments your function takes.</dd>
</dl>
<p> <b>update_option</b> : update_option( $option_name, $newvalue ); <br />
this use to store the option value .<br />
<b>delete_option</b> : delete_option($name); <br />
  delete the name of the option .<br />
<b>get_option</b> :get_option( $name, $default ) <br />
get the option value .<br />
<br />
Reference : <a href='http://codex.wordpress.org/Function_Reference/update_option'>Function Reference/update option</a> </p>
<h3>Add to the theme</h3>
<p>
From the above knowledge , we can easy to add theme options for our wordpress site now . First , let&#8217;s  do a &#8216;hello world&#8217; demo . add footer links  manage option  for the last <a title='free wordpress theme' href='http://www.brightyoursite.com/blog/2010/01/11/your-first-normal-wordpress-template/'> free wordpress theme </a> ,you may notice the footer links home ,contact &#8230;. those are hand-coded in the theme . so now we need add it to the theme options in order to make it editable via admin panel .
</p>
<p>Save following codes in the functions.php in the wordpress theme .</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> </span>
<span style="color: #009900;">function bright_addThemePage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #009900;">   $<span style="color: #000066;">ThemeName</span>=get_current_theme<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">    if <span style="color: #66cc66;">&#40;</span> $_GET<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'page'</span><span style="color: #66cc66;">&#93;</span> == basename<span style="color: #66cc66;">&#40;</span>__FILE__<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>	</span>
<span style="color: #009900;">	    // save settings</span>
<span style="color: #009900;">		if <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'save'</span> == $_REQUEST<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'action'</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> 		</span>
<span style="color: #009900;">			check_admin_referer<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'save-theme-properties'</span> <span style="color: #66cc66;">&#41;</span>;  </span>
<span style="color: #009900;">			update_option<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'bright_foot'</span>, stripslashes<span style="color: #66cc66;">&#40;</span>$_REQUEST<span style="color: #66cc66;">&#91;</span> <span style="color: #ff0000;">'bright_foot'</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;	 </span>
<span style="color: #009900;">			// goto theme edit page</span>
<span style="color: #009900;">			header<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Location: themes.php?page=functions.php&amp;saved=true&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">			die;</span>
<span style="color: #009900;">  		// reset settings</span>
<span style="color: #009900;">		<span style="color: #66cc66;">&#125;</span> else if<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'reset'</span> == $_REQUEST<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'action'</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> </span>
<span style="color: #009900;">			delete_option<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'bright_foot'</span><span style="color: #66cc66;">&#41;</span>;		 </span>
<span style="color: #009900;">			// goto theme edit page</span>
<span style="color: #009900;">			header<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Location: themes.php?page=functions.php&amp;reset=true&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">			die;</span>
<span style="color: #009900;">		<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #009900;">	<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #009900;">	add_theme_page<span style="color: #66cc66;">&#40;</span> $ThemeName . <span style="color: #ff0000;">' Theme Options'</span>, $ThemeName . <span style="color: #ff0000;">' Options'</span>, <span style="color: #ff0000;">'edit_themes'</span>, basename<span style="color: #66cc66;">&#40;</span>__FILE__<span style="color: #66cc66;">&#41;</span>, <span style="color: #ff0000;">'bright_themePage'</span> <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;"><span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #009900;">function bright_themePage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> </span>
<span style="color: #009900;"><span style="color: #66cc66;">&#123;</span></span>
<span style="color: #009900;">       $<span style="color: #000066;">ThemeName</span>=get_current_theme<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </span>
<span style="color: #009900;">	if <span style="color: #66cc66;">&#40;</span> $_REQUEST<span style="color: #66cc66;">&#91;</span> <span style="color: #ff0000;">'saved'</span> <span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span> echo <span style="color: #ff0000;">'&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;strong&gt;</span></span>Settings saved.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/strong<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>';
	if ( $_REQUEST[ 'reset' ] ) echo '<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;message&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;updated fade&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;strong<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Settings reset.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/strong<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>';
?&gt;
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;wrap&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span> 
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;border-bottom:none;&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> echo $ThemeName; <span style="color: #000000; font-weight: bold;">?&gt;</span></span> Theme Configuration<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h2<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;form</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">&quot;post&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span> 
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> if <span style="color: #66cc66;">&#40;</span> function_exists<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'wp_nonce_field'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> wp_nonce_field<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'save-theme-properties'</span> <span style="color: #66cc66;">&#41;</span>; <span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span> 	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;width:575px;float:left;padding-bottom:30px;&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h3<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Footer Links Management<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h3<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Manage footer links here.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;table</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">cellspacing</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000066;">cellpadding</span>=<span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;editform form-table&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span> 
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tr<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;th<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>  footer links <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/th<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;td</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">'width:80%'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;textarea</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;bright_foot&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;bright_foot&quot;</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;width: 100%; height: 10em;&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;code&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> echo get_settings<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;bright_foot&quot;</span><span style="color: #66cc66;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/textarea<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/table<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>		 
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;action&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;save&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
				 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">align</span>=<span style="color: #ff0000;">&quot;right&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;save&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Save Settings&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;br</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;clear:both;&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>	
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>	</span>
<span style="color: #009900;"><span style="color: #66cc66;">&#125;</span>//end of themepage function</span>
<span style="color: #009900;">  add_action<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'admin_menu'</span>, <span style="color: #ff0000;">'bright_addThemePage'</span> <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">  <span style="color: #000000; font-weight: bold;">?&gt;</span></span></pre></div></div>

<p> Now , we need change the footer.php</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;footer&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
   <span style="color: #009900;">&lt;?=get_option<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;bright_foot&quot;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h1<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> <span style="color: #ddbb00;">&amp;copy;</span> 2009 www.brightyoursite.com All Rights Reserved.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h1<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>  
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_footer<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Take a notice with  the <b> delete_option( &#8216;bright_foot&#8217;) </b> , <b> update_option( &#8216;bright_foot&#8217;, stripslashes($_REQUEST[ 'bright_foot'] )) </b> , <b>get_option( &#8220;bright_foot&#8221; )</b> <b>&#8216;bright_foot&#8217;</b> that&#8217;s the key of option , it must the same . <b>$_REQUEST[ 'bright_foot'] &lt;textarea name=&#8221;bright_foot&#8221;&gt; </b> also the same .<br />
</p>
<h3>More applications</h3>
<p>
From the hello world demo, we can easy to add more options and change it to manage  advertisement , we also can use this to add specific category to home page as featured posts , for instance :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;featured&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span></span>
<span style="color: #009900;">wp_reset_query<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">$count = get_option<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'theme_featured_count'</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">query_posts<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'showposts='</span> . $count . <span style="color: #ff0000;">'&amp;cat='</span> . get_cat_ID<span style="color: #66cc66;">&#40;</span>get_option<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'featured'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">if <span style="color: #66cc66;">&#40;</span>have_posts<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> : while <span style="color: #66cc66;">&#40;</span>have_posts<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> : the_post<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;post&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;featured-body&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span> 
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;featured-text&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;h1<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;&lt;?php the_permalink() ?&gt;</span></span>&quot; class=&quot;featured-title&quot;&gt;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/h1<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;?php</span> excerpt<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'30'</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><span style="color: #808080; font-style: italic;">&lt;!-- END Post --&gt;</span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> endwhile; endif; wp_reset_query<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><span style="color: #808080; font-style: italic;">&lt;!-- END featured --&gt;</span></pre></div></div>

<p>put those in your index.php also <b> add two more options in the function.php theme_featured_count</b> and  featured</b> . You also can customize it do add a slider images.
</p>
<h3>Download</h3>
<p>
<a href='http://www.brightyoursite.com/demo/wordpress/ThemeOptions.zip'>Theme option hello world demo </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.brightyoursite.com/blog/2010/02/10/add-theme-options-for-your-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

