<?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>JaypeeOnline &#187; widgetize WordPress theme</title> <atom:link href="http://jaypeeonline.net/tag/widgetize-wordpress-theme/feed/" rel="self" type="application/rss+xml" /><link>http://jaypeeonline.net</link> <description>Technology, Blogging News, WordPress Theme and Plugin Reviews, Tips and Tricks</description> <lastBuildDate>Fri, 10 Feb 2012 01:41:37 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=</generator> <item><title>HowTo: Widgetize a WordPress Theme</title><link>http://jaypeeonline.net/tips-tricks/howto-widgetize-a-wordpress-theme/</link> <comments>http://jaypeeonline.net/tips-tricks/howto-widgetize-a-wordpress-theme/#comments</comments> <pubDate>Fri, 20 Mar 2009 06:16:22 +0000</pubDate> <dc:creator>Jaypee Habaradas</dc:creator> <category><![CDATA[Tips and Tricks]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[sidebar]]></category> <category><![CDATA[widget support]]></category> <category><![CDATA[widget-ready]]></category> <category><![CDATA[widgetize theme]]></category> <category><![CDATA[widgetize WordPress theme]]></category> <category><![CDATA[widgetize wp theme]]></category> <category><![CDATA[widgets]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://jaypeeonline.net/?p=3656</guid> <description><![CDATA[From my experience reviewing different WordPress themes, I noticed that one of the main features that a lot of users look for in a theme is being &#8220;widget-ready&#8220;. This is due to the fact that widgets have become a very popular tool for bloggers especially for WordPress users. Also, a lot of WordPress plugins these [...]]]></description> <content:encoded><![CDATA[<p><img
src="http://maxcdn.jaypeeonline.net/images/widgets.png" alt="WordPress Widgets" /></p><p>From my experience reviewing different <strong>WordPress themes</strong>, I noticed that one of the main features that a lot of users look for in a theme is being &#8220;<strong>widget-ready</strong>&#8220;. This is due to the fact that widgets have become a very popular tool for bloggers especially for WordPress users. Also, a lot of <a
href="http://jaypeeonline.net/category/wordpress-plugins/">WordPress plugins</a> these days include a widget version of the plugin. Unfortunately, not all theme designers realize the importance and popularity of widgets and create themes that are not widget-ready.</p><p>For those of you who use or rely heavily on widgets, finding a beautiful and well designed WordPress theme that&#8217;s not widget-ready can be very disappointing, right? You end up looking for another theme thats widget-ready. Wouldn&#8217;t it be nice if you can widgetize or make any WordPress theme widget-ready? This short tutorial will show you how to widgetize a WordPress theme.</p><p>Before you start, make sure you <strong>backup your theme files</strong> so that if something goes wrong, you can always revert to the original files.</p><p>Now to start. First thing you&#8217;ll need is a <strong>functions.php</strong> file within your theme folder. Most <a
href="http://jaypeeonline.net/category/wordpress-themes/">WordPress themes</a> already have it but in case you don&#8217;t, all you need to do is <strong>create a blank text document</strong> using Notepad or any other text editor, save it as <strong>functions.php</strong> and copy/paste the following code into that blank file.</p><p>[php]<br
/> &lt;?php<br
/> if ( function_exists(&#8216;register_sidebar&#8217;) )<br
/> register_sidebars(3,array(<br
/> &#8216;before_widget&#8217; =&gt; &#8221;,<br
/> &#8216;after_widget&#8217; =&gt; &#8221;,<br
/> &#8216;before_title&#8217; =&gt; &#8221;,<br
/> &#8216;after_title&#8217; =&gt; &#8221;,<br
/> ));<br
/> ?&gt;<br
/> [/php]</p><p>In the code above, you can edit the following lines: <strong>’before_widget’</strong>, <strong>‘after_widget’</strong>, <strong>‘before_title’</strong> and <strong>‘after_title’</strong> to fit your preference or theme&#8217;s design.</p><p>Example, if I want to make the widget to behave like a list, I would edit it like this:</p><p>[php]<br
/> &#8216;before_widget&#8217; =&gt; &#8216;&lt;li&gt;&#8217;,<br
/> &#8216;after_widget&#8217; =&gt; &#8216;&lt;/li&gt;&#8217;,<br
/> [/php]</p><p>Then if I want the widget title to use a specific heading parameter like say &lt;h3&gt;, I do this:</p><p>[php]<br
/> &#8216;before_title&#8217; =&gt; &#8216;&lt;h3&gt;&#8217;,<br
/> &#8216;after_title&#8217; =&gt; &#8216;&lt;/h3&gt;&#8217;,<br
/> [/php]</p><p>If I want to make it <em>italic</em>, I replace &lt;h3&gt;&lt;/h3&gt; tags with &lt;i&gt;&lt;/i&gt; tags or if I want it to be <strong>bold</strong>, I replace it with &lt;strong&gt;&lt;/strong&gt; tags.</p><p>When you&#8217;re done with it, save and upload the <strong>functions.php</strong> file via FTP into your theme&#8217;s folder. (e.g. <strong>http://domain.com/wp-content/themes/wptheme/</strong>)</p><p>Now that you&#8217;ve created the <strong>functions.php file</strong>, what you need now is the code that calls or displays the widget. Most users prefer to use widgets on the sidebar but this code can be placed in the bottom bar or footer or anywhere you want to have widgets (depending on the design of the WordPress theme).</p><p>Open the <strong>sidebar.php</strong> file (or any file that holds the area where you want to have widgets) and <strong>copy/paste</strong> the following code where you want the widget to be displayed.</p><p><strong>Widget code</strong><br
/> [php]<br
/> &lt;?php<br
/> if (function_exists(’dynamic_sidebar’) &amp;&amp; dynamic_sidebar(1) ) : else : ?&gt;</p><p>&lt; ?php endif; ?&gt;<br
/> [/php]</p><p>What this code basically does is that it checks if your theme supports widgets and looks for the dynamic sidebar function to see if it exists (code that we placed in the functions.php file earlier). When it finds the dynamic sidebar function, it executes everything between the <strong>if</strong> statement and the <strong>&lt;?php endif; ?&gt;</strong> statement. It means you can add anything or other stuff that aren&#8217;t widgets like an ad banner or script before or after the widget code. You can also add stuff in between the widget code if you want it to display something else in case the function doesn&#8217;t exist.</p><p>Btw, if you want multiple sections to be widgetized, just copy/paste the widget code and replace <strong>(1)</strong> with the corresponding number, <strong>(2)</strong> if its the second or <strong>(3)</strong> if its the third one.</p><p>That&#8217;s it. Wasn&#8217;t that easy? Now you don&#8217;t have to worry about finding a theme that doesn&#8217;t have widget support because you can do it yourself and make any WordPress theme widgetized or widget-ready.</p><p>Hope you found this simple tutorial helpful and useful. If you liked this post, please don&#8217;t forget to <a
href="http://feeds2.feedburner.com/jaypeeonline/HhAk">subscribe to my RSS feed</a> or share this post with others using the social bookmarking buttons below. Thanks!</p><div
id="crp_related"><ul><li><a
href="http://jaypeeonline.net/wordpress-themes/wp-theme-review-dfmarine/" rel="bookmark" class="crp_title">WP Theme Review: dfMarine</a></li><li><a
href="http://jaypeeonline.net/wordpress-plugins/dashboard-notepad-wordpress-plugin/" rel="bookmark" class="crp_title">Dashboard Notepad WordPress Plugin</a></li><li><a
href="http://jaypeeonline.net/wordpress-themes/wp-theme-review-rhea-v10/" rel="bookmark" class="crp_title">WP Theme Review: Rhea v1.0</a></li><li><a
href="http://jaypeeonline.net/wordpress-themes/wp-theme-review-irresistible/" rel="bookmark" class="crp_title">WP Theme Review: Irresistible</a></li><li><a
href="http://jaypeeonline.net/wordpress-themes/wp-theme-review-zexee/" rel="bookmark" class="crp_title">WP Theme Review: Zexee</a></li><li><a
href="http://jaypeeonline.net/wordpress-themes/wp-theme-review-itheme/" rel="bookmark" class="crp_title">WP Theme Review: iTheme</a></li><li><a
href="http://jaypeeonline.net/wordpress-themes/wp-theme-review-navigate/" rel="bookmark" class="crp_title">WP Theme Review: Navigate</a></li><li><a
href="http://jaypeeonline.net/wordpress-plugins/wp-plugin-review-google-syntax-highlighter/" rel="bookmark" class="crp_title">WP Plugin Review: Google Syntax Highlighter</a></li><li><a
href="http://jaypeeonline.net/wordpress-themes/wp-theme-review-rebel-magazine/" rel="bookmark" class="crp_title">WP Theme Review: Rebel Magazine</a></li><li><a
href="http://jaypeeonline.net/wordpress-themes/wp-theme-review-wp-premium/" rel="bookmark" class="crp_title">WP Theme Review: WP Premium</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://jaypeeonline.net/tips-tricks/howto-widgetize-a-wordpress-theme/feed/</wfw:commentRss> <slash:comments>21</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)
Database Caching 18/25 queries in 0.070 seconds using disk
Object Caching 556/599 objects using disk
Content Delivery Network via maxcdn.jaypeeonline.net

Served from: jaypeeonline.net @ 2012-02-14 05:07:01 -->
