<?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>Fearless Flyer Web Design &#187; Blog</title> <atom:link href="http://fearlessflyer.com/tag/blog/feed/" rel="self" type="application/rss+xml" /><link>http://fearlessflyer.com</link> <description>Fearless flyer is a blog that focuses on the latest topics of web design. This includes Wordpress, SEO, Photoshop, jQuery, PHP and CSS. Fearless flyer is owned and operated by Michael Soriano, a seasoned web developer living in Southern California.</description> <lastBuildDate>Tue, 07 Sep 2010 21:02:16 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Elegant Themes &#8211; Best Value Themes Club</title><link>http://fearlessflyer.com/2009/12/elegant-themes-best-value-themes-club/</link> <comments>http://fearlessflyer.com/2009/12/elegant-themes-best-value-themes-club/#comments</comments> <pubDate>Thu, 31 Dec 2009 19:45:05 +0000</pubDate> <dc:creator>michael soriano</dc:creator> <category><![CDATA[General]]></category> <category><![CDATA[WP Themes]]></category> <category><![CDATA[Blog]]></category> <category><![CDATA[Blogger]]></category> <category><![CDATA[Design]]></category> <category><![CDATA[grunge]]></category> <category><![CDATA[premium theme]]></category> <category><![CDATA[Web 2.0]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[WP]]></category><guid isPermaLink="false">http://fearlessflyer.com/?p=1080</guid> <description><![CDATA[With the increasing popularity of WordPress comes the business of developing &#8220;bi-products&#8221; that support this amazing blogging platform. This includes the countless plugins, web hosting, developer support and of course &#8211; the most marketable of them all: premium themes. A number of leading designers have already dominated this WordPress premium themes market; quite notably: Woothemes, [...]]]></description> <content:encoded><![CDATA[<p>With the increasing popularity of WordPress comes the business of developing &#8220;bi-products&#8221; that support this amazing blogging platform. This includes the countless plugins, web hosting, developer support and of course &#8211; the most marketable of them all: premium themes.</p><p>A number of leading designers have already dominated this WordPress premium themes market; quite notably: <a href="http://fearlessflyer.com/u/woothemes">Woothemes</a>, <a href="http://themereviewer.net/u/l">DIYThemes</a> and <a href="http://www.studiopress.com/">StudioPress</a>.</p><p>But amongst these big names you may have come across a more succinct, straightforward and classy premium theme designer &#8211; simply named &#8220;<a href="http://fearlessflyer.com/u/elegantthemes">Elegant Themes</a>&#8220;.</p><h3>Who is Elegant Themes?</h3><p>Elegant Themes is owned by a designer named <a href="http://twitter.com/elegantthemes">Nick Roach</a>. This means that all of the designs and code that is produced from Elegant Themes is from this mighty fellow. According to Nick:</p><blockquote><p>I created this website to provide WordPress themes of quality and integrity. I craft my themes with a goal of simplicity and professionalism and strive to inject each design with a dose of modest elegance. I believe that your website is not just a tool, it is an integral part of your identity. My job is to respect each customer by providing attractive and userfriendly templates that will help you achieve your online goals.</p></blockquote><h3>What&#8217;s so special about Elegant Themes?</h3><p><strong>Quality over quantity. </strong> Elegant Themes is hardly a large collection &#8211; I mean, there&#8217;s only about 30 downloadable themes at the time of this writing. But note they are quite high quality. Check out some of them below:</p><p><strong><a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=147&#038;keyword=wooden&#038;custom=97">Wooden</a></strong></p><p>Very down to earth, classy and professionally done &#8211; this theme can transform your blog into a modern website wonder.<br /> <a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=147&#038;keyword=wooden&#038;custom=97"><img src="http://fearlessflyer.com/main/wp-content/uploads/2009/12/wooden.jpg" alt="wooden" title="Wooden By Elegant Themes" width="576" height="323" class="alignnone size-full wp-image-1101" /></a></p><p><strong><a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=147&#038;keyword=lumin&#038;custom=96">Lumin</a></strong></p><p>Soothing to the eye with subtle textures and sharp, detailed accents &#8211; this theme is packed with visual amenities that scream <strong>WEB 2.0</strong>!<br /> <a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=147&#038;keyword=lumin&#038;custom=96"><img src="http://fearlessflyer.com/main/wp-content/uploads/2009/12/lumin.jpg" alt="lumin" title="Lumin by Elegant Themes" width="576" height="323" class="alignnone size-full wp-image-1100" /></a></p><p><strong><a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=147&#038;keyword=grungemag&#038;custom=98">GrungeMag</a></strong></p><p>Semi-magazine, semi-newspaper &#8211; beautiful textures, slider, thumbnails &#8211; simply stunning.<br /> <a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=147&#038;keyword=grungemag&#038;custom=98"><br /> <img src="http://fearlessflyer.com/main/wp-content/uploads/2009/12/grungemag.jpg" alt="grungemag" title="Grungemag by Elegant Themes" width="576" height="323" class="alignnone size-full wp-image-1099" /></a></p><p><strong><a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=147&#038;keyword=evid&#038;custom=99">Evid</a></strong></p><p>Create your own “<strong>Hulu</strong>” styled video website with this theme:<br /> <a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=147&#038;keyword=evid&#038;custom=99"><br /> <img src="http://fearlessflyer.com/main/wp-content/uploads/2009/12/evid.jpg" alt="evid" title="Evid by Elegant Themes" width="576" height="323" class="alignnone size-full wp-image-1098" /><br /> </a></p><p><strong><a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=147&#038;keyword=deviant&#038;custom=100">Deviant</a></strong></p><p>The ultimate grunge look! Random page tears, crumpled paper, dirty textures &#8211; you want your blog to stand out from the crowd &#8211; this be the theme for you!<br /> <a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=147&#038;keyword=deviant&#038;custom=100"><img src="http://fearlessflyer.com/main/wp-content/uploads/2009/12/deviant.jpg" alt="deviant" title="Deviant by Elegant Themes" width="576" height="323" class="alignnone size-full wp-image-1096" /></a></p><p>Like Nick said &#8211; <em>&#8220;each design is injected with a dose of modest elegance&#8221;</em>. With each theme you will find excellent color schema, superb use of typography, plenty of textures, just the right amount of Javascript, and above all &#8211; originality. The themes obviously took time to build.</p><h3>You Can&#8217;t Beat 20 Bucks a Year!</h3><p>I don&#8217;t think I can elaborate on this any further. $20 dollars a year gives you unlimited access to all of Elegant Themes. Whether you’re a blog owner, an entrepreneur, or even a web developer &#8211; you’ve already won by having this arsenal of elegant designs to beautify your websites; all for about the same price as a bucket of fried chicken. <a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=147&#038;keyword=join&#038;url=3">Head on over to Elegant Themes!</a></p> ]]></content:encoded> <wfw:commentRss>http://fearlessflyer.com/2009/12/elegant-themes-best-value-themes-club/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Add a Style Switcher to your WordPress Theme</title><link>http://fearlessflyer.com/2009/12/add-a-style-switcher-to-your-wordpress-theme/</link> <comments>http://fearlessflyer.com/2009/12/add-a-style-switcher-to-your-wordpress-theme/#comments</comments> <pubDate>Sat, 05 Dec 2009 22:29:17 +0000</pubDate> <dc:creator>michael soriano</dc:creator> <category><![CDATA[General]]></category> <category><![CDATA[Tutorials]]></category> <category><![CDATA[WP Themes]]></category> <category><![CDATA[admin panel]]></category> <category><![CDATA[Blog]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[Options]]></category> <category><![CDATA[style switcher]]></category> <category><![CDATA[theme]]></category> <category><![CDATA[Wordpress]]></category><guid isPermaLink="false">http://fearlessflyer.com/?p=991</guid> <description><![CDATA[Whenever I download a WordPress theme there’s hardly ever a time that I leave it as is. Almost for sure &#8211; I will have to change some things to customize according to the site’s identity. For instance, maybe I’d want to match the heading styles to a company logo, or change the background colors to [...]]]></description> <content:encoded><![CDATA[<p>Whenever I download a WordPress theme there’s hardly ever a time that I leave it as is. Almost for sure &#8211; I will have to change some things to customize according to the site’s identity. For instance, maybe I’d want to match the heading styles to a company logo, or change the background colors to have the same schema or simply change the link styles to have a sharper look. Wouldn’t it be nice to have the ability to change all of this by switching style sheets from the theme options?</p><p>This tutorial will show you how to create a simple style switcher from your themes options panel. It will have a single drop down list with all the available styles to pick from. Once saved &#8211; your theme will switch to the selected style. Ready to get started &#8211; let’s begin:</p><h3>Part 1 – Set up functions.php</h3><p>First thing you need is a <strong>functions.php</strong> file. A functions file is an optional “plugin” type of file you can include in your theme directory folder.  One of its’ purpose is to setup administration options for your theme – which is exactly what we’re doing. Create a file and name it “<strong>functions.php</strong>” and paste the code below. Note that you need to change variables that define your theme name (<strong>$themename</strong>) and the short name (<strong>$shortname</strong>) to match your themes:</p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
&nbsp;
<span style="color: #000088;">$themename</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;My Sweet Theme&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$shortname</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;mst&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;name&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Style Sheet&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;desc&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Enter the Style Sheet you would like to use for Sweet Ass Theme&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;id&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$shortname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;_style_sheet&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;type&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;select&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;options&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;default&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;green&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;blue&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;yellow&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
	<span style="color: #0000ff;">&quot;std&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;default&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div><p>The above code initializes your theme options structure. First it defines several variables, including a multi-dimensional array (which will become our drop down list containing the four selectable options that will dictate our style sheets). Next is to copy the code below. This code loops through each iteration of the array we declared previously. It assigns a type of form field, displays labels and applies the correct descriptions etc. It also includes several functions that saves the form data, resets information and displays status messages etc. It&#8217;s a wee bit technical &#8211; so its better if we simply copy and paste the code.</p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> mytheme_add_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$themename</span><span style="color: #339933;">,</span> <span style="color: #000088;">$shortname</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'page'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'save'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
update_option<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> update_option<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#93;</span>  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> delete_option<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: themes.php?page=functions.php&amp;saved=true&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">die</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'reset'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
delete_option<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: themes.php?page=functions.php&amp;reset=true&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">die</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
add_theme_page<span style="color: #009900;">&#40;</span><span style="color: #000088;">$themename</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; Options&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$themename</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; Options&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'edit_themes'</span><span style="color: #339933;">,</span> <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mytheme_admin'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> mytheme_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$themename</span><span style="color: #339933;">,</span> <span style="color: #000088;">$shortname</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'saved'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;strong&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$themename</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' settings saved.&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'reset'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;strong&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$themename</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' settings reset.&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;div class=&quot;wrap&quot;&gt;
&lt;h2&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$themename</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> Settings&lt;/h2&gt;
&nbsp;
&lt;form method=&quot;post&quot;&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;open&quot;</span><span style="color: #339933;">:</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;table width=&quot;100%&quot; border=&quot;0&quot; style=&quot;background-color:#eef5fb; padding:10px;&quot;&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;close&quot;</span><span style="color: #339933;">:</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;/table&gt;&lt;br /&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;title&quot;</span><span style="color: #339933;">:</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;table width=&quot;100%&quot; border=&quot;0&quot; style=&quot;background-color:#dceefc; padding:5px 10px;&quot;&gt;&lt;tr&gt;
&lt;td valign=&quot;top&quot; colspan=&quot;2&quot;&gt;&lt;h3 style=&quot;font-family:Georgia,'Times New Roman',Times,serif;&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h3&gt;&lt;/td&gt;
&lt;/tr&gt;
&nbsp;
&lt;!--custom--&gt;
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span> 
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;sub-title&quot;</span><span style="color: #339933;">:</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;h3 style=&quot;font-family:Georgia,'Times New Roman',Times,serif; padding-left:8px;&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h3&gt; 
&lt;!--end-of-custom--&gt;
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'text'</span><span style="color: #339933;">:</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; width=&quot;20%&quot; rowspan=&quot;2&quot; valign=&quot;middle&quot;&gt;&lt;strong&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/strong&gt;&lt;/td&gt;
&lt;td width=&quot;80%&quot;&gt;&lt;input style=&quot;width:400px;&quot; name=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; id=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; type=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> get_settings<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">echo</span> get_settings<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'std'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;&lt;/td&gt;
&lt;/tr&gt;
&nbsp;
&lt;tr&gt;
&lt;td&gt;&lt;small&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'desc'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/small&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;margin-bottom:5px;border-bottom:1px dotted #000000;&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'textarea'</span><span style="color: #339933;">:</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; width=&quot;20%&quot; rowspan=&quot;2&quot; valign=&quot;middle&quot;&gt;&lt;strong&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/strong&gt;&lt;/td&gt;
&lt;td width=&quot;80%&quot;&gt;&lt;textarea name=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; style=&quot;width:400px; height:200px;&quot; type=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; cols=&quot;&quot; rows=&quot;&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> get_settings<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">echo</span> get_settings<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'std'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/textarea&gt;&lt;/td&gt;
&nbsp;
&lt;/tr&gt;
&nbsp;
&lt;tr&gt;
&lt;td&gt;&lt;small&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'desc'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/small&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;margin-bottom:5px;border-bottom:1px dotted #000000;&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'select'</span><span style="color: #339933;">:</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;tr&gt;
&lt;td width=&quot;20%&quot; rowspan=&quot;2&quot; valign=&quot;middle&quot;&gt;&lt;strong&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/strong&gt;&lt;/td&gt;
&lt;td width=&quot;80%&quot;&gt;&lt;select style=&quot;width:240px;&quot; name=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; id=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'options'</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$option</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;option<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> get_settings<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$option</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' selected=&quot;selected&quot;'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$option</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'std'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' selected=&quot;selected&quot;'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$option</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/option&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/select&gt;&lt;/td&gt;
&lt;/tr&gt;
&nbsp;
&lt;tr&gt;
&lt;td&gt;&lt;small&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'desc'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/small&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;margin-bottom:5px;border-bottom:1px dotted #000000;&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;checkbox&quot;</span><span style="color: #339933;">:</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;tr&gt;
&lt;td width=&quot;20%&quot; rowspan=&quot;2&quot; valign=&quot;middle&quot;&gt;&lt;strong&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/strong&gt;&lt;/td&gt;
&lt;td width=&quot;80%&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>get_option<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000088;">$checked</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;checked=<span style="color: #000099; font-weight: bold;">\&quot;</span>checked<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span> <span style="color: #000088;">$checked</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;input type=&quot;checkbox&quot; name=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; id=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; value=&quot;true&quot; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$checked</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;
&lt;/td&gt;
&lt;/tr&gt;
&nbsp;
&lt;tr&gt;
&lt;td&gt;&lt;small&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'desc'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/small&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;margin-bottom:5px;border-bottom:1px dotted #000000;&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;p class=&quot;submit&quot;&gt;
&lt;input name=&quot;save&quot; type=&quot;submit&quot; value=&quot;Save changes&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;save&quot; /&gt;
&lt;/p&gt;
&lt;/form&gt;
&lt;form method=&quot;post&quot;&gt;
&lt;p class=&quot;submit&quot;&gt;
&lt;input name=&quot;reset&quot; type=&quot;submit&quot; value=&quot;Reset&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;reset&quot; /&gt;
&lt;/p&gt;
&lt;/form&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_menu'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mytheme_add_admin'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div><p>Test out your theme options by going under the “<strong>Appearance</strong>” section &gt; “<strong>Your Theme Name Options</strong>” tab. You will see the drop down list with the selectors already in place. Once you hit “<strong>Save Changes</strong>” &#8211; it saves your data. While clicking “<strong>Reset</strong>” sets it back to the default selector. We also see nice status messages appear on top each time we update.</p><p><img class="alignnone size-full wp-image-998" title="Screenshot of the theme options page" src="http://fearlessflyer.com/main/wp-content/uploads/2009/12/style-sheet-switcher1.jpg" alt="style-sheet-switcher1" width="541" height="195" /></p><h3>Part 2 – Create the Style Sheets</h3><p>Create four .css files that correspond to the drop down list selections we defined in our functions.php. The names do not have to exactly match the selectors (but is wise to have some meaningful relation to the names). Save these four files in the root directory of your theme:</p><p><strong>style.css</strong> &#8211; this style sheet is for a black background page with white colored fonts.</p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* CSS Document */</span>
body <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#000000</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FFFFFF</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div><p><strong>green.css</strong> &#8211; this style sheet is for a green background page with white colored fonts.</p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* CSS Document */</span>
body <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#3bae09</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FFFFFF</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div><p><strong>blue.css</strong> &#8211; this style sheet is for a blue background page with white colored fonts.</p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* CSS Document */</span>
body <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#038aba</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FFFFFF</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div><p><strong>yellow.css</strong> &#8211; this style sheet is for… you get the picture.</p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* CSS Document */</span>
body <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#f6f658</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#333333</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div><h3>Part 3 – The Switch Statement</h3><p>Now that we have our options working in the back end, and we have our four style sheets sitting in the root folder waiting to be called, all we need now is a way to flip the style sheets in our header file.  We achieve this by using a standard switch statement. A <strong>switch statement</strong> in php is an alternative to the the “if…else” statement. It uses the case keyword which we use to match our selectors to execute a statement that calls the appropriate style sheet. In the default header.php file &#8211; look for the line of code below and delete it:</p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;link rel=&quot;stylesheet&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'stylesheet_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;</pre></td></tr></table></div><p>This is the standard call for the default style.css file which we no longer need. Next, paste the code below inside your <strong>header.php</strong> file:</p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$options</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>get_settings<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'std'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> get_settings<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">?&gt;</span>			
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$mst_style_sheet</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		 <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;default&quot;</span><span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;link rel=&quot;stylesheet&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'stylesheet_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>	
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;green&quot;</span><span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;link rel=&quot;stylesheet&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/green.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;blue&quot;</span><span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;link rel=&quot;stylesheet&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/blue.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;yellow&quot;</span><span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;link rel=&quot;stylesheet&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/yellow.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>	
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div><p>The above code is quite self explanatory. First it grabs whichever values we’ve stored in our theme options. Second &#8211; is the switch statement for our drop down list, followed by cases for each entry &#8211; with its unique statement calling the style sheets.</p><p>Now if you go back to your style switcher and select “<strong>blue</strong>” &#8211; your theme style should switch to blue &#8211; and so on and so forth.</p><p>You can have as many styles as you wish to integrate in your options. As well as the amount of customization in the actual .css files is completely up to you. You can download the source files from this <strong><a href="http://fearlessflyer.com/downloads/style-switcher.zip">link</a></strong> &#8211; simply add these files in your theme folder and change some values &#8211; and your theme will instantly have it’s own style switcher.</p> ]]></content:encoded> <wfw:commentRss>http://fearlessflyer.com/2009/12/add-a-style-switcher-to-your-wordpress-theme/feed/</wfw:commentRss> <slash:comments>15</slash:comments> </item> <item><title>Free PSD &#8211; Grunge Blog Layout</title><link>http://fearlessflyer.com/2009/10/free-psd-grunge-blog-layout/</link> <comments>http://fearlessflyer.com/2009/10/free-psd-grunge-blog-layout/#comments</comments> <pubDate>Mon, 26 Oct 2009 03:51:19 +0000</pubDate> <dc:creator>michael soriano</dc:creator> <category><![CDATA[Freebies]]></category> <category><![CDATA[General]]></category> <category><![CDATA[HTML and PSD]]></category> <category><![CDATA[Photoshop]]></category> <category><![CDATA[portfolio]]></category> <category><![CDATA[Blog]]></category> <category><![CDATA[Blogger]]></category> <category><![CDATA[grunge]]></category> <category><![CDATA[PSD]]></category> <category><![CDATA[Random]]></category> <category><![CDATA[Typepad]]></category> <category><![CDATA[Watercolor]]></category> <category><![CDATA[Wordpress]]></category><guid isPermaLink="false">http://fearlessflyer.com/?p=819</guid> <description><![CDATA[Just in time for Halloween &#8211; I give you &#8220;Argyle&#8217;s Drudge&#8221;, a fully layered Photoshop file that can be the base design of your next blog. In time for Halloween because it does have that messy, random and scary feel to it &#8211; don&#8217;t you think? The design is wholly unexpected &#8211; colors of October [...]]]></description> <content:encoded><![CDATA[<p>Just in time for Halloween &#8211; I give you <strong>&#8220;Argyle&#8217;s Drudge&#8221;</strong>, a fully layered Photoshop file that can be the base design of your next blog. In time for Halloween because it does have that messy, random and scary feel to it &#8211; don&#8217;t you think? The design is wholly unexpected &#8211; colors of October Green, Blood Shine Red and Mildew Blue. Stacks of shadowed crumpled paper make up the main container with a sidebar &#8211; which is the common trend in personal blog layouts.</p><p><a href="http://fearlessflyer.com/main/wp-content/uploads/2009/10/argyles-drudge.jpg"><img src="http://fearlessflyer.com/main/wp-content/uploads/2009/10/grunge-1.jpg" alt="grunge-1" title="Full Size Preview - Click to Enlarge" width="576" height="758" class="alignnone size-full wp-image-821" /></a></p><p>Argyle’s Drudge has a very narrow content area of only 746 pixels. I chose to stay away from the standard 960 grid design because I find that grunge layouts don’t seem to play well with it. Speaking of grid based design, find this <a href="http://fearlessflyer.com/2009/10/taming-the-grid-align-your-wordpress-posts-perfectly-using-php-and-css/">article</a> about lining up your posts perfectly within the grid. As I was saying &#8211; the whole point of grunge is random and spontaneous &#8211; conforming to a grid just doesn’t fit.</p><h3>More Details:</h3><p>The pale blue watercolor splash background is courtesy of my <a href="http://backgrounds.mysitemyway.com/free-background-image/29/website-wallpaper-id/20/style-id/1/watercolor-grunge/pale-blue-pine/">Backgrounds etc</a>. The beautiful hand sketched fonts is known as <strong>“Fail Font”</strong> and can be downloaded from <a href="http://www.dafont.com/fail.font">DaFont.com</a>. Note that since “Fail Font” is free &#8211; it’s the perfect opportunity to use Cufon in your coding. Cufon is the technology that enables you to use any kind of font in your pages (<a href="http://fearlessflyer.com/2009/10/cufonize-your-pages-how-to-add-cufon-to-your-web-design/">read article</a>).</p><p>Argyle’s Drudge is completely free to use for your next theme of choice. May it be WordPress, Blogger, Typepad: all I ask in return is for you to follow my updates in <a href="http://twitter.com/mks6804">Twitter</a> or leave a comment below.</p><p><strong>Download <a href="http://fearlessflyer.com/downloads/argyles-drudge.zip">Argyles Drudge</a>.</strong></p> ]]></content:encoded> <wfw:commentRss>http://fearlessflyer.com/2009/10/free-psd-grunge-blog-layout/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Free WP Theme &#8211; The Garamond</title><link>http://fearlessflyer.com/2009/05/free-wp-theme-the-garamond/</link> <comments>http://fearlessflyer.com/2009/05/free-wp-theme-the-garamond/#comments</comments> <pubDate>Fri, 15 May 2009 23:21:16 +0000</pubDate> <dc:creator>michael soriano</dc:creator> <category><![CDATA[Freebies]]></category> <category><![CDATA[General]]></category> <category><![CDATA[WP Themes]]></category> <category><![CDATA[Wordpress Themes]]></category> <category><![CDATA[Blog]]></category> <category><![CDATA[Blogger]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[free]]></category> <category><![CDATA[premium theme]]></category> <category><![CDATA[template]]></category> <category><![CDATA[the grid]]></category> <category><![CDATA[Themes]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[WP]]></category><guid isPermaLink="false">http://fearlessflyer.com/?p=497</guid> <description><![CDATA[Just got done experimenting with a theme. This time &#8211; no photoshop mockups are done; went ahead and dove right in coding. I ended up with a simple, non-graphic intensive theme. Named it after one of my all time favorite fonts &#8211; the Garamond. View the Demo The Home Page The Garamond&#8217;s home page mimicks [...]]]></description> <content:encoded><![CDATA[<p>Just got done experimenting with a theme. This time &#8211; no photoshop mockups are done; went ahead and dove right in coding. I ended up with a simple, non-graphic intensive theme. Named it after one of my all time favorite fonts &#8211; the <strong>Garamond</strong>.</p><div class="viewdemo"><a href="http://garamond.fearlessflyer.com">View the Demo</a></div><h3>The Home Page</h3><p>The Garamond&#8217;s home page mimicks a magazine layout. This was made possible without any special wordpress queries, nor does it filter by categories. Instead, the latest post is automatically styled different. Thanks to this neat trick by <a href="http://www.ruhanirabin.com/how-to-style-the-latest-post-in-wordpress/?dsq=9376478#comment-9376478">Ruhani Rabin</a>. The feature image and the thumbnails are automatically resized upon client request. Meaning, you can upload any size image (preferably wider than 540 pixels &#8211; which is the size of the container), assign it to a custom field &#8211; and voila! Images are cropped, zoomed and sharpened when once the browser hits it. The code I used is from Darren Hoyt known as <a href="http://www.darrenhoyt.com/2008/04/02/timthumb-php-script-released/">TimThumb</a>.</p><h3>The Inner Pages</h3><p>The Garamond is a bloggers theme. Traditional templates are intact: search, archive, category etc. I also included an authors bio at the end of each single post, as well as an author template which grabs all their articles. I went a little overboard in styling the subheadings for the post (shown below). The default font family used is of course &#8211; Garamond; although since it is not a standard font &#8211; Georgia is used as back up. The contrast between the larger text and the tiny Verdana is striking &#8211; which I felt was good.</p><p><img src="http://fearlessflyer.com/main/wp-content/uploads/2009/05/garamond-detaill.jpg" alt="garamond-detaill" title="garamond-detaill" width="576" height="500" class="alignnone size-full wp-image-498" /></p><h3>Other Features</h3><p>The two sidebars and the footer are all widget driven. Comments support Gravatars, pagination as well as multi-level threads. I&#8217;ve also added a random quote container right below the header &#8211; which requires the <a href="http://www.italyisfalling.com/stray-random-quotes/">Stray Quotes</a> plugin by Italyisfalling.com<br /> <br/><br /> You can view the demo from this <a href="http://garamond.fearlessflyer.com/">link</a>, or <strong>download directly from <a href="http://fearlessflyer.com/downloads/the-garamond.zip">here</a>.</strong> All I ask is for you leave a comment below &#8211; or follow my updates via <strong><a href="http://twitter.com/_fearlessflyer">twitter</a></strong>.</p> ]]></content:encoded> <wfw:commentRss>http://fearlessflyer.com/2009/05/free-wp-theme-the-garamond/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>How to change the Background Dynamically in your WordPress Theme</title><link>http://fearlessflyer.com/2009/05/how-to-change-the-background-dynamically-in-your-wordpress-theme/</link> <comments>http://fearlessflyer.com/2009/05/how-to-change-the-background-dynamically-in-your-wordpress-theme/#comments</comments> <pubDate>Sat, 09 May 2009 19:01:44 +0000</pubDate> <dc:creator>michael soriano</dc:creator> <category><![CDATA[General]]></category> <category><![CDATA[Tutorials]]></category> <category><![CDATA[Blog]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[php]]></category> <category><![CDATA[Themes]]></category> <category><![CDATA[tips]]></category> <category><![CDATA[tricks]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[WP]]></category> <category><![CDATA[WP Themes]]></category><guid isPermaLink="false">http://fearlessflyer.com/?p=486</guid> <description><![CDATA[We all have seen WordPress sites with repeating backgrounds that span beautifully across the entire page. This property is usually applied in the body tag of your template. What about those portfolio websites that use a different background image in the front page? Or those magazine styled websites that apply different backgrounds for their category [...]]]></description> <content:encoded><![CDATA[<p>We all have seen WordPress sites with repeating backgrounds that span beautifully across the entire page. This property is usually applied in the body tag of your template.  What about those portfolio websites that use a different background image in the front page? Or those magazine styled websites that apply different backgrounds for their category pages? How’d they do that?</p><h3>The problem</h3><p>For anyone who’s developed a WordPress theme would know how to break it up in templates: header.php, sidebar.php , footer.php etc. And as I’ve mentioned: you control the background image (if you want it to span the entire page) usually in the body tag of your HTML.  The problem is – the body tag comes BEFORE any other tag in your templates.</p><p>For example, take a look at the screenshot of a typical header.php file below. It shows the body tag where you apply a different property value in the CSS file each time you want it unique from another page:</p><p><img src="http://fearlessflyer.com/main/wp-content/uploads/2009/05/bg-tut1.jpg" alt="bg-tut1" title="bg-tut1" width="576" height="200" class="alignnone size-full wp-image-488" /></p><p>The problem is, in your special template, you’ve already called the get header file:</p><p><img src="http://fearlessflyer.com/main/wp-content/uploads/2009/05/bg-tuts2.jpg" alt="bg-tuts2" title="bg-tuts2" width="576" height="200" class="alignnone size-full wp-image-487" /></p><h3>The Answer – Conditional Tags</h3><p>WordPress is built is such a way that you can control almost every aspect of your pages. One useful snippet is known as Conditional Tags. Conditional tags can be used in your templates to change what is displayed on a particular page – like the background image. Examples of conditional tags are: is_single(), is_front_page() or is_admin(). For more information on Conditional Tags – see the this <a href="http://codex.wordpress.org/Conditional_Tags">link</a> from WordPress Codex library. In our case – we’re going to use the tag is_page_template().</p><h3>Step 1: Insert the PHP</h3><p>Open your header.php in your text editor. You’re going to add a conditional statement in inside the opening body id tag. In my case, I’m using three different backround images. Two of them, I want to apply in two individual templates, while the rest of the pages share a default image:</p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;body id=&quot;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_page_template<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template-diff-bg-demo1.php'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
       <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;template-diff-bg-demo1&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span> 
<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span>is_page_template<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template-diff-bg-demo2.php'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
       <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;template-diff-bg-demo2&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;default&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; &gt;</pre></td></tr></table></div><p><strong>Explanation:</strong> If the template used is named “template-diff-bg-demo1.php”, echo a body id of “template-diff-bg-demo1”, or if template used is named “template-diff-bg-demo2.php” use body id of “template-diff-bg-demo2”, otherwise – just use body id of “default”.</p><h3>Step 2: The CSS</h3><p>Open your styles.css. We’re going to match the body ids that are going to be called each time you switch page templates. In our case – we need three different ids:</p><ul><li>body# template-diff-bg-demo1 – a different background</li><li>body# template-diff-bg-demo2 – another background</li><li>body#default – the default background</li></ul><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">body<span style="color: #cc00cc;">#default</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/default-bg.jpg</span><span style="color: #00AA00;">&#41;</span> <span style="color: #000000; font-weight: bold;">top</span> <span style="color: #993333;">center</span> <span style="color: #993333;">no-repeat</span> <span style="color: #cc00cc;">#000000</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
body<span style="color: #cc00cc;">#template-diff-bg-demo1</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span>images/default-bg2.jpg<span style="color: #00AA00;">&#41;</span> <span style="color: #000000; font-weight: bold;">top</span> <span style="color: #993333;">center</span> <span style="color: #993333;">no-repeat</span> <span style="color: #cc00cc;">#000000</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
body<span style="color: #cc00cc;">#template-diff-bg-demo2</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span>images/default-bg3.jpg<span style="color: #00AA00;">&#41;</span> <span style="color: #000000; font-weight: bold;">top</span> <span style="color: #993333;">center</span> <span style="color: #993333;">no-repeat</span> <span style="color: #cc00cc;">#000000</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div><h3>Conclusion</h3><p>There you have it. We dynamically changed the body ids of our theme – according to specific page templates. Changing the body ids allowed us style them differently in our stylesheet. This is just one of many possibilities in displaying content (or in our case – style) by using WordPress’ conditional tags. Check out the demo using the code above from this <a href="http://squid.fearlessflyer.com/page-2/">link</a>. Happy Coding!</p><p><a href="http://squid.fearlessflyer.com/page-2/"><img src="http://fearlessflyer.com/main/wp-content/uploads/2009/05/bg-tuts3.jpg" alt="bg-tuts3" title="bg-tuts3" width="600" height="200" class="alignnone size-full wp-image-489" /></a></p> ]]></content:encoded> <wfw:commentRss>http://fearlessflyer.com/2009/05/how-to-change-the-background-dynamically-in-your-wordpress-theme/feed/</wfw:commentRss> <slash:comments>9</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)

Served from: fearlessflyer.com @ 2010-09-09 10:59:15 -->