<?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>Maddison Designs &#187; Tutorial</title>
	<atom:link href="http://maddisondesigns.com/tag/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://maddisondesigns.com</link>
	<description>Professional Web Design &#38; Development</description>
	<lastBuildDate>Wed, 25 Jan 2012 07:33:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Modifying your WordPress Theme to disable image comments</title>
		<link>http://maddisondesigns.com/2011/01/modifying-your-wordpress-theme-to-disable-image-comments/</link>
		<comments>http://maddisondesigns.com/2011/01/modifying-your-wordpress-theme-to-disable-image-comments/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 11:41:42 +0000</pubDate>
		<dc:creator>Anthony Hortin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Comments]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Post]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://maddisondesigns.com/?p=1304</guid>
		<description><![CDATA[One of the benefits of having a blog, no matter whether it&#8217;s WordPress or something else, is being able to interact with your readers through the use of Comments. Obviously, the downside to this is the Spam that you also attract. Thankfully there&#8217;s quite a few plugins around now that allow you to automatically filter out the majority of Spam<p><a class="more-link" href="http://maddisondesigns.com/2011/01/modifying-your-wordpress-theme-to-disable-image-comments/" title="Continue reading &#8216;Modifying your WordPress Theme to disable image comments&#8217;">Continue Reading &#8594;</a></p>]]></description>
			<content:encoded><![CDATA[<p>One of the benefits of having a blog, no matter whether it&#8217;s WordPress or something else, is being able to interact with your readers through the use of Comments. Obviously, the downside to this is the Spam that you also attract. Thankfully there&#8217;s quite a few plugins around now that allow you to automatically filter out the majority of Spam comments.</p>
<p><span id="more-1304"></span></p>
<h3>The problem&#8230;</h3>
<p>Recently though, I found out that within WordPress you can also leave comments on images as well as Posts. It came to my attention through a test blog that I have setup. I use this test site as a &#8220;staging server&#8221; when I&#8217;m making the final touches to a clients website, prior to cutting it across to their &#8220;live&#8221; domain. It allows me to show the client the finished product with all their content and allows them to check for any last minute revisions. Most of the time Comments are normally Disabled through the Dashboard Settings option (Settings &gt; Discussion &gt; Allow people to post comments on new articles) however recently I started receiving Spam Comments on images themselves. This was happening even though Comments were disabled. It seems that even if your WordPress blog is configured to not allow comments, depending on your theme, it may still be possible for someone to post comments via one of your images.</p>
<h3>The solution&#8230;</h3>
<p>To get around this, you will need to create an <strong>attachment.php</strong> file for your theme, if it doesn&#8217;t already have one. If one does exist, WordPress will use your attachment.php file when viewing a single attachment, such as an image. Since all themes are different, I&#8217;ll show you how to make the modifications to the standard <em>Twenty Ten</em> theme that comes bundled with WordPress.</p>
<p>At around <strong>Line 111 </strong>in the <strong>attachment.php</strong> file that is included in the <em>Twenty Ten</em> theme, you should see a line that calls the comments template. It will look like this&#8230;</p>
<pre>&lt;?php comments_template(); ?&gt;</pre>
<p>To avoid having comments posted on your images when you&#8217;ve disabled them, simply replace this line with the following&#8230;</p>
<pre>&lt;?php if (comments_open($post-&gt;post_parent)) {
   // Only show the Comments Form if the parent post has comments open
   comments_template();
} ?&gt;</pre>
<p>The <em>If </em>statement in the first line checks the Parent Post to see if comments are allowed and if so, will then call the comments template. If comments aren&#8217;t allowed, the comments form wont be displayed. The second line is simply a std PHP code comment and can be removed if you&#8217;d prefer. Personally though, I like to keep my code well documented.</p>
<p>Of course, if you&#8217;d rather not have comments posted on images (or any attachments), then you could also simply comment out or remove the call to the comments_template() function all together, from your attachment.php file.</p>
<p>If your theme doesn&#8217;t have an attachment.php file, you will need to create one. The simplest way to do this is to start by duplicating (&amp; renaming) your single.php file and then adding in the extra functionality as per the attachment.php file included in the <em>Twenty Ten</em> theme.</p>
<p>I know that I&#8217;ll be including an attachment.php file in any themes that I create from now on. Leave a comment and let me know if this has helped you. <img src='http://maddisondesigns.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://maddisondesigns.com/2011/01/modifying-your-wordpress-theme-to-disable-image-comments/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Adding a WordPress 3.0 menu to your theme</title>
		<link>http://maddisondesigns.com/2010/07/adding-a-wordpress-3-0-menu-to-your-theme/</link>
		<comments>http://maddisondesigns.com/2010/07/adding-a-wordpress-3-0-menu-to-your-theme/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 12:23:27 +0000</pubDate>
		<dc:creator>Anthony Hortin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Menu]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://maddisondesigns.com/?p=1079</guid>
		<description><![CDATA[One of the things that has been really lacking in WordPress is the ability to easily administer your theme menu(s). Sure, there are quite a few plugins available that made it significantly easier, but there was never any &#8220;built in&#8221; methods. This has now changed with the release of WordPress 3.0 and in my opinion, it&#8217;s one its best new<p><a class="more-link" href="http://maddisondesigns.com/2010/07/adding-a-wordpress-3-0-menu-to-your-theme/" title="Continue reading &#8216;Adding a WordPress 3.0 menu to your theme&#8217;">Continue Reading &#8594;</a></p>]]></description>
			<content:encoded><![CDATA[<p>One of the things that has been really lacking in WordPress is the ability to easily administer your theme menu(s). Sure, there are quite a few plugins available that made it significantly easier, but there was never any &#8220;built in&#8221; methods. This has now changed with the release of WordPress 3.0 and in my opinion, it&#8217;s one its best new features.</p>
<p><span id="more-1079"></span></p>
<p>The only catch of course, is that your theme needs to support this new feature. Fear not though, as you&#8217;ll see here, it&#8217;s extremely easy to implement into your existing theme.</p>
<h3>Step 1: Register your menu</h3>
<p>The first thing you need to do is to register your menu so that you can use it within your theme. There are two functions you can use, depending whether you&#8217;d like to register just one menu or multiple menus.</p>
<p>To register a single navigation menu, use:</p>
<p><a title="register_nav_menu on the WordPress Codex" href="http://codex.wordpress.org/Function_Reference/register_nav_menu">register_nav_menu</a>( $location, $description );</p>
<p><strong>$location</strong> is the slug name<br />
<strong>$description</strong> is the label used within the Dashboard</p>
<p>To register a multiple navigation menus, use:</p>
<p><a title="register_nav_menus on the WordPress Codex" href="http://codex.wordpress.org/Function_Reference/register_nav_menus">register_nav_menus</a>( $locations = array() );</p>
<p><strong>$location</strong> is an array of menu slug names &amp; labels</p>
<p>Within your<strong> functions.php</strong> file, add the following code to register your menu. To ensure backwards compatibility for earlier versions of WordPress, verify the function exists prior to usage by calling <em>function_exists()</em>.</p>
<pre>if ( function_exists( 'register_nav_menu' ) ) {
	register_nav_menu( 'main-menu', 'Main Menu' );
}</pre>
<h3>Step 2: Displaying your new menu</h3>
<p>There are two ways that you can display your navigation menu within your theme. You can either add the menu directly into your theme code using the <em>wp_nav_menu()</em> function, or you can add the menu by using the new <em>Custom Menu</em> widget.</p>
<h4>Using the Custom Menu widget</h4>
<p>Provided your theme allows for widgets, simply drag the <em>Custom Menu</em> Widget across to one of your sidebars. You can then give it an (optional) Title as well as selecting your menu from the drop-down list. The name that appears in the list will be the label that you used in the call to <em>register_nav_menu()</em>.</p>
<p style="text-align: center;"><img class="size-full wp-image-1087 aligncenter" title="custom-menu-widget" src="http://maddisondesigns.com/wp-content/uploads/2010/07/custom-menu-widget.jpg" alt="" width="600" height="250" /></p>
<h4>Using the wp_nav_menu function</h4>
<p>If you&#8217;d like more control over your menu, you can use the <a title="wp_nav_menu on the WorPress Codex" href="http://codex.wordpress.org/Function_Reference/wp_nav_menu">wp_nav_menu()</a> function. The simplest form is to simply call it without any arguments, by adding the following code to your theme wherever you&#8217;d like your menu to appear.</p>
<pre>&lt;?php wp_nav_menu(); ?&gt;</pre>
<p>For even more customisation, the following arguments are available to use:</p>
<ul>
<li><strong>$menu:</strong> (string) The menu that is desired; accepts (matching in order) id,  slug,  name</li>
<li><strong>$container:</strong> (string) Whether to wrap the <em>ul</em>, and what to wrap it with</li>
<li><strong>$container_class:</strong> (string) The class that is applied to the container</li>
<li><strong>$container_id:</strong> (string) The ID that is applied to the container</li>
<li><strong>$menu_class:</strong> (string) CSS class to use for the<em> ul</em> element which forms the menu</li>
<li><strong>$menu_id:</strong> (string) The ID that is applied to the<em> ul</em> element which forms the menu</li>
<li><strong>$echo:</strong> (boolean) Whether to echo the menu or return it</li>
<li><strong>$fallback_cb:</strong> (string) If the menu doesn&#8217;t exists, the callback function to use</li>
<li><strong>$before:</strong> (string) Output text before the link text</li>
<li><strong>$after:</strong> (string) Output text after the link text</li>
<li><strong>$link_before:</strong> (string) Output text before the link</li>
<li><strong>$link_after:</strong> (string) Output text after the link</li>
<li><strong>$depth:</strong> (integer) How many levels of the hierarchy are to be included where 0 means all</li>
<li><strong>$walker:</strong> (object) Custom walker object to use</li>
<li><strong>$theme_location:</strong> (string) The location in the theme to be used &#8211; must be registered with register_nav_menu() in order to be selectable by the user</li>
</ul>
<p>For our particular menu we want to specify the menu that we registered earlier (main-menu). We also want to specify the  containing class for the menu. Within your theme files, wherever you&#8217;d like your menu displayed, add the following code.</p>
<pre>&lt;?php wp_nav_menu( array( 'menu' =&gt; 'main-menu', 'container_class' =&gt; 'nav' ) ); ?&gt;</pre>
<h3>Step 3: Setting up your menu within the Dashboard</h3>
<p>After you&#8217;ve updated your theme files, the next task is to actually set up your menu within the WordPress Dashboard. The <strong><em>Menus</em></strong> option can be found within the <em>Appearance</em> section of the left hand navigation. Once you click this, you should be presented with something similar to the image below&#8230;</p>
<p style="text-align: center;"><img class="size-full wp-image-1114 aligncenter" title="img_setting-up-your-menu-in-the-dashboard" src="http://maddisondesigns.com/wp-content/uploads/2010/07/img_setting-up-your-menu-in-the-dashboard.jpg" alt="" width="600" height="600" /></p>
<h4>3.1 Select your menu</h4>
<p><em>Section (a)</em> is where you select your menu that you&#8217;d like to use. The only menus displayed are the ones that you&#8217;ve registered within your <em>functions.php</em> file.</p>
<h4>3.2 Specifying custom links</h4>
<p>If you&#8217;d like to specify a custom link, as opposed one of your existing Pages, simply enter the URL and a menu label into <em>Section (b)</em>. Once you click the <strong>Add to Menu</strong> button, your new menu item will appear in <em>Section (e)</em>.</p>
<h4>3.3 Specifying a page link</h4>
<p>Most times you&#8217;ll simply want your menu items to link to Pages that you&#8217;ve created. <em>Section (c)</em> allows you to select which pages you&#8217;d like to link. Simply tick the appropriate checkboxes and then click the <strong>Add to Menu</strong> button.</p>
<h4>3.4 Naming your menu</h4>
<p>Enter in an appropriate name for your menu in the <strong>Menu Name</strong> text field in <em>Section (d)</em>. This name should match the name that you&#8217;ve used when registering your menu in the <em>functions.php file</em> which in turn matches the name used in the <em>wp_nav_menu</em> function, without the hyphens. In our case the menu name would simply be <strong>Main Menu</strong>.</p>
<h4>3.5 Fine-tuning your menu options</h4>
<p><em>Section (e)</em> is where all your menu items will be listed. Clicking the small <em>down arrow</em> next to each menu item will display the individual menu options shown above. Each of the menu items can be easily dragged into a more appropriate order if so required. Also, if your menu is going to be a dropdown menu, then you can also drag the items onto each other so as to form a hierarchy.</p>
<p>If you find that not all the above menu options are displaying such as <em>CSS Classes</em> or if the <em>Custom Links </em>section is not displayed, for example, then click on the <strong>Screen Options </strong>link at the top-right of the Dashboard. You will be presented with a configuration panel where you can specify what options are displayed.</p>
<p style="text-align: center;"><img class="size-full wp-image-1119 aligncenter" title="img_screen-options" src="http://maddisondesigns.com/wp-content/uploads/2010/07/img_screen-options.jpg" alt="" width="600" height="250" /></p>
<p>Simply tick the options that you&#8217;d like to appear. For example, ticking the <em>Posts </em>checkbox will allow you to add your Posts to your menu in the same way that you add your Pages. If you&#8217;d like to be able to specify a particular class for an individual menu item, tick the <em>CSS Classes</em> checkbox. This is handy if your dropdown menu requires you to add specific classes to the first &amp; last dropdown menu items, for styling purposes.</p>
<h4>3.6 Saving your menu</h4>
<p>Last but not least, don&#8217;t forget to save your menu by clicking the <strong>Save Menu </strong>button on the far right of the screen (not displayed).</p>
<h3>Step 4: Styling your menu</h3>
<p>Although I&#8217;m not going to go into how you style your menu using css, I would like to point out one handy feature of this new menu system. You can use the <strong>current-menu-item </strong>class to style the menu option of the currently selected page. This allows you to highlight or identify the individual menu item associated with the page that is currently being viewed. As an example, the following CSS could be used to style our current menu item. Since I specified the <em>container_class </em>as <em>nav </em>when I originally set up the menu, I need to include this class as part of the css.</p>
<pre>.nav li.current-menu-item a {
        font-weight:bold;
	color:#0082c8;
}</pre>
<p>This should give you enough information to add a WP3.0 custom menu to any of your themes. It&#8217;s a great feature for this new version of WordPress and one which I&#8217;ll be using quite frequently from now on.</p>
<p>Have you implemented this new menu feature in your theme? Are you planing on using the new menus feature? Leave a comment and let me know. I&#8217;d love to hear. <img src='http://maddisondesigns.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://maddisondesigns.com/2010/07/adding-a-wordpress-3-0-menu-to-your-theme/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Never Ever Have Blank Lines Outside Your WordPress PHP Tags</title>
		<link>http://maddisondesigns.com/2010/03/never-ever-have-blank-lines-outside-your-wordpress-php-tags/</link>
		<comments>http://maddisondesigns.com/2010/03/never-ever-have-blank-lines-outside-your-wordpress-php-tags/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 23:13:45 +0000</pubDate>
		<dc:creator>Anthony Hortin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://maddisondesigns.info/?p=897</guid>
		<description><![CDATA[I had my day planned out nicely. Only a few minor updates to make on my WordPress theme for my new site and I would&#8217;ve been done (coding wise). Then it happened! I logged into the admin Dashboard to make a few content tweaks and things seemed a bit strange. When I tried to save some content updates, the page<p><a class="more-link" href="http://maddisondesigns.com/2010/03/never-ever-have-blank-lines-outside-your-wordpress-php-tags/" title="Continue reading &#8216;Never Ever Have Blank Lines Outside Your WordPress PHP Tags&#8217;">Continue Reading &#8594;</a></p>]]></description>
			<content:encoded><![CDATA[<p>I had my day planned out nicely. Only a few minor updates to make on my <a title="Wordpress website" href="http://wordpress.org">WordPress</a> theme for my new site and I would&#8217;ve been done (coding wise). Then it happened! I logged into the admin Dashboard to make a few content tweaks and things seemed a bit strange. When I tried to save some content updates, the page just wouldn&#8217;t refresh properly. I even tried logging out of the dashboard&#8230; But still no luck <img src='http://maddisondesigns.com/wp-includes/images/smilies/icon_cry.gif' alt=':cry:' class='wp-smiley' /> </p>
<p><span id="more-897"></span></p>
<p>Next up, I tested the site to see if it was up and running ok. On the surface things looked fine but then I noticed that when I tried to type in a URL without the trailing forward-slash (&#8216;/&#8217;), the page wouldn&#8217;t appear. Normally, depending on how you&#8217;ve configured your <a title="Permalinks on the WordPress Codex" href="http://codex.wordpress.org/Using_Permalinks">Permalinks</a>, it will simply add the trailing slash automatically. Instead, all I got was a blank white screen starring back at me. Needless to say, a few expletives were uttered!</p>
<p>I tried thinking back to when everything seemed to be working fine. I also tried to remember what changes I&#8217;d made the day before. From memory, it was mainly some CSS updates to change links colours. There were no major code updates from what I could remember. I also couldn&#8217;t work out why the URL&#8217;s weren&#8217;t being processed correctly. After doing some Googling, I decided to raise a (low priority) support ticket with my hosting provider to see if any server changes had been made within the last few days. It was as if the .htaccess rules weren&#8217;t being obeyed. Good and bad news. The good news&#8230; no changes had been made to the server. The bad news&#8230; this didn&#8217;t get me any closer to resolving my issue.</p>
<p>The next step was to try changing to the default WordPress theme and do some testing. Things seemed to improved after changing themes. I could save my pages consistently. I could log in and out of the Dashboard without a problem. Even the URL&#8217;s worked fine, with or without the trailing slashes. Hmmm It would appear that the culprit was my own theme, which I&#8217;d been lovingly hand crafting. Next test was a restore from a backup of my theme. Luckily I&#8217;m quite strict at performing backups. I perform a backup of my workstation and my development server every couple of days, with the files kept on a separate hard drive. I rotate between 4 different sets for each machine. I restored the oldest backup which was just over a week old. Sure enough, everything worked fine. The next backup I tried was one from only two days prior. This also worked fine. Things were starting to look up! What this meant was that I&#8217;d narrowed it down to being caused by the changes that I&#8217;d made the previous day.</p>
<p>I now needed to compare the latest version of my code (the one with the problems) to the version from two days prior. I downloaded and installed <a title="WinMerge website" href="http://winmerge.org">WinMerge</a>, which is an extremely handy Open Source differencing and merging tool (for Windows). Luckily there weren&#8217;t too many files changed. As mentioned earlier, most of the changes were in my main stylesheet. Starting from a copy of my restored (working) theme, I slowly started to integrate the changes that I&#8217;d made the previous day. Most seemed fairly mundane. A few CSS changes and some very minor code updates. I then got to my <em>functions.php</em> file. I incorporated the changes and lo and behold, things broke immediately. Yay!! I&#8217;d found the damn file that was causing all my problems! Now it was simply a matter of narrowing down the exact cause.</p>
<p>Looking through the code reminded me of the changes that I&#8217;d made. I&#8217;d added a few comments to the code to document a couple of the functions (Silly me, I know! Real developers don&#8217;t document code!!). The other thing I&#8217;d done was to add a blank line in between where I&#8217;d closed a PHP tag and opened up the next one. The code snippet is question looked like this&#8230;</p>
<p style="text-align: center;"><img class="size-full wp-image-899 aligncenter" title="functions-php-code-fragment-before" src="http://maddisondesigns.com/wp-content/uploads/2010/03/functions-php-code-fragment-before.jpg" alt="" width="600" height="150" /></p>
<p>You&#8217;ll notice that between the closing PHP tag and the following opening tag, there&#8217;s a blank line. Gasp!! This is what was causing all the drama! The solution was to simply remove the offending blank line. In fact, since I was simply closing the PHP tag and immediately reopening it, I could easily omit both of them. The resulting code looked like&#8230;</p>
<p style="text-align: center;"><img class="size-full wp-image-898 aligncenter" title="functions-php-code-fragment-after" src="http://maddisondesigns.com/wp-content/uploads/2010/03/functions-php-code-fragment-after.jpg" alt="" width="600" height="150" /></p>
<p>As for the problems that it caused, well there were quite are few.</p>
<h3>URL&#8217;s weren&#8217;t processed properly</h3>
<p>Since my Permalinks were setup using the format &#8220;<em><strong>/%year%/%monthnum%/%postname%/</strong></em>&#8220;, the posts wouldn&#8217;t display properly if they didn&#8217;t have the trailing slash. Normally, this is something that is handled by your <em>.htaccess</em> file. Instead, I was simply receiving a blank page unless I specifically had the slash on the end of the URL.</p>
<h3>Strange content appearing</h3>
<p>This was a strange one. As you can see in the image below, characters such as quotes and apostrophes were being rendered incorrectly. You&#8217;d think this was because their was some &#8216;strange&#8217; characters stored in the database, but nope, it displayed perfectly fine once <em>functions.php</em> was fixed.</p>
<p style="text-align: center;"><img class="size-full wp-image-901 aligncenter" title="invalid-characters-being-rendered" src="http://maddisondesigns.com/wp-content/uploads/2010/03/invalid-characters-being-rendered.jpg" alt="" width="600" height="150" /></p>
<h3>Blank lines appearing at top of document source, before the DOCTYPE</h3>
<p>One of the repercussions of the blank line &#8220;incident&#8221; was that it caused blank lines to appear before the DOCTYPE within the html. This can cause problems with your RSS feed, in particular with Feedburner. Blank lines (outside of PHP tags) in any of your page templates can also cause the same problem, so I made sure I thoroughly checked those as well.</p>
<h3>Problems in the WP Dashboard</h3>
<p>As mentioned above, one of the first things that alerted me to the problem was my administration dashboard becoming unstable. I found that whenever I tried to save some content changes, the page wouldn&#8217;t refresh. Also, I couldn&#8217;t even log out of the WordPress Dashboard. I was able to browse through the various menu options within the Dashboard, but when it came to performing an action such as saving a page, that&#8217;s when the problems surfaced.</p>
<p>Due the the &#8216;strangeness&#8217; of some of the problems, this was one bug that took a while to track down. Thankfully though, it&#8217;s all fixed now. It&#8217;s certainly something that I&#8217;ll be more mindful of in the future when I create themes.</p>
<p>Have you come across this problem or any other strange issues? I&#8217;d love to hear, so feel free to leave a comment <img src='http://maddisondesigns.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://maddisondesigns.com/2010/03/never-ever-have-blank-lines-outside-your-wordpress-php-tags/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>How To Add Multiple Widget Sidebars To Your WordPress Blog</title>
		<link>http://maddisondesigns.com/2010/03/how-to-add-multiple-widget-sidebars-to-your-wordpress-blog/</link>
		<comments>http://maddisondesigns.com/2010/03/how-to-add-multiple-widget-sidebars-to-your-wordpress-blog/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 07:23:32 +0000</pubDate>
		<dc:creator>Anthony Hortin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Sidebar]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Widgets]]></category>

		<guid isPermaLink="false">http://maddisondesigns.info/?p=810</guid>
		<description><![CDATA[I’ve found that the term “sidebar” within WordPress can have multiple meanings. Within your index.php file you will most likely find a call to the php function get_sidebar(). This is referring to the sidebar column, sometimes called the right-hand (or left-hand) navigation column. A sidebar also refers to the location where you add all your Widgets. The Widgets control the<p><a class="more-link" href="http://maddisondesigns.com/2010/03/how-to-add-multiple-widget-sidebars-to-your-wordpress-blog/" title="Continue reading &#8216;How To Add Multiple Widget Sidebars To Your WordPress Blog&#8217;">Continue Reading &#8594;</a></p>]]></description>
			<content:encoded><![CDATA[<p>I’ve found that the term “sidebar” within WordPress can have multiple meanings. Within your <em>index.php</em> file you will most likely find a call to the php function <em>get_sidebar()</em>. This is referring to the sidebar column, sometimes called the right-hand (or left-hand) navigation column. A sidebar also refers to the location where you add all your Widgets. The Widgets control the content that appears within the sidebar (column) and will usually display lists such as your Recent Posts, Categories, Links or dozens of other items.</p>
<p><span id="more-810"></span></p>
<p>Since WordPress is so configurable, it’s possible to have multiple sidebar columns defined such as when you have multiple page templates set up. For example, you may have a specific page template defined for your sites static homepage. As well as defining the body content for that page, you can also define a separate sidebar in case you would like it to appear differently from the rest of the site.</p>
<p>It’s also possible to register multiple sidebars that contain all the widgets. This latter sidebar is what we’ll be discussing here. A typical WordPress theme may only have one sidebar configured although it’s not uncommon to have 2 or 3 or even more. Even though it’s called a “sidebar” it doesn’t need to specifically reside in the sidebar of your website. You can add a “sidebar” to anywhere in your site you want to display your widgets. A common place to include them is the site footer.</p>
<h2>Defining your new sidebar</h2>
<p>Adding additional sidebars to your site is relatively easy. Within your <em>functions.php</em> file you will most likely have something similar to the code below, for your existing sidebar.</p>
<pre>&lt;?php

if ( function_exists('register_sidebar') ) {

   register_sidebar(array(
   'before_widget' =&gt; '&lt;li id="%1$s" class="widget %2$s"&gt;',
   'after_widget' =&gt; '&lt;/li&gt;',
   'before_title' =&gt; '&lt;h2 class="widgettitle"&gt;',
   'after_title' =&gt; '&lt;/h2&gt;'
   ));

}?&gt;</pre>
<p>To add another sidebar you simply need to register another instance. If you are registering more than one, then you will also need to name them. Change your <em>functions.php</em> file to look like the following. Take care to add in the extra line that specifies the name of your sidebar. Once these are functions are defined, you will notice the extra sidebar appear in the WordPress Dashboard under the <em>Appearance &gt; Widgets</em> option. It’s here that you can drag and drop all your widgets into your various sidebars.</p>
<pre>&lt;?php

if ( function_exists('register_sidebar') ) {

   register_sidebar(array(
   'name' =&gt; 'sidebar 1',
   'before_widget' =&gt; '&lt;div id="%1$s" class="widget %2$s"&gt;',
   'after_widget' =&gt; '&lt;/div&gt;',
   'before_title' =&gt; '&lt;h2&gt;',
   'after_title' =&gt; '&lt;/h2&gt;'
    ));

   register_sidebar(array(
   'name' =&gt; 'footer sidebar 1',
   'before_widget' =&gt; '&lt;div id="%1$s" class="widget %2$s"&gt;',
   'after_widget' =&gt; '&lt;/div&gt;',
   'before_title' =&gt; '&lt;h2&gt;',
   'after_title' =&gt; '&lt;/h2&gt;'
   ));

}?&gt;</pre>
<p>You can find more details on the various parameters of the above call on the <a title="register_sidebar function on the WordPress Codex" href="http://codex.wordpress.org/Function_Reference/register_sidebar">WordPress Codex</a>.</p>
<h2>Adding your new sidebar to your template</h2>
<p>Within your <em>sidebar.php</em> file, change the call to your existing sidebar to include its name that you defined within the <em>functions.php</em> file earlier.</p>
<pre>&lt;?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar 1') ) : ?&gt;

   &lt;h2&gt;Articles by month&lt;/h2&gt;
   &lt;ul&gt;
      &lt;?php wp_get_archives('title_li=&amp;type=monthly'); ?&gt;
   &lt;/ul&gt;
   &lt;h2&gt;Categories&lt;/h2&gt;
   &lt;ul&gt;
      &lt;?php wp_list_categories('show_count=0&amp;title_li='); ?&gt;
   &lt;/ul&gt;

&lt;?php endif; ?&gt;</pre>
<p>To add your new sidebar, you can either copy the above code or you can simply copy the following lines. Add these lines to wherever you’d like your new widgets to appear. In this example you can see from the name that I’m placing mine in the footer of my website. As before, don’t forget to specify the correct sidebar name. In the above code, the html that appears between the php statements is what will appear when there are no widgets added to your sidebar. This ‘default’ code can obviously be modified to suit your theme. In the following code, since there is no extra html, nothing will be displayed unless a widget has been added into the sidebar within your WordPress dashboard.</p>
<pre>&lt;?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer sidebar 1') ) : ?&gt;
&lt;?php endif; ?&gt;</pre>
<p>You will now find that your site has two widgetized sidebars. As mentioned earlier, there’s no reason why you couldn’t include further ones. It’s simply a matter of registering the new sidebar and then including the php to display it, in the relevant part of your site template.</p>
<p>I’ve also published this tutorial on <a title="Twitter Study Group website" href="http://www.twitterstudygroup.com/wordpress/?p=92">Twitter Study Group</a>. It&#8217;s a great place to learn, so check it out.</p>
<p><a class="noborder" href="http://www.twitterstudygroup.com/wordpress/?p=92"><img class="size-full wp-image-813" title="twitter-study-group-logo" src="http://maddisondesigns.com/wp-content/uploads/2010/03/twitter-study-group-logo.jpg" alt="" width="385" height="77" /></a></p>
<p>Thinking of adding more widgets to your WordPress site? Leave a comment and let me know if you found this useful. Thanks <img src='http://maddisondesigns.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://maddisondesigns.com/2010/03/how-to-add-multiple-widget-sidebars-to-your-wordpress-blog/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Creating A Tilt-Shift Effect Using Photoshop</title>
		<link>http://maddisondesigns.com/2010/02/creating-a-tilt-shift-effect-using-photoshop/</link>
		<comments>http://maddisondesigns.com/2010/02/creating-a-tilt-shift-effect-using-photoshop/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 03:45:27 +0000</pubDate>
		<dc:creator>Anthony Hortin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[Tilt-Shift]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://maddisondesigns.info/?p=769</guid>
		<description><![CDATA[A Tilt-Shift effect on your image gives it the impression that the subject is actually a scale model. It does this by dramatically simulating a shallow Depth of Field along with an increase in the color saturation. To get the best effect, it’s advisable to use an image that is looking down on your subject. An image such as a<p><a class="more-link" href="http://maddisondesigns.com/2010/02/creating-a-tilt-shift-effect-using-photoshop/" title="Continue reading &#8216;Creating A Tilt-Shift Effect Using Photoshop&#8217;">Continue Reading &#8594;</a></p>]]></description>
			<content:encoded><![CDATA[<p>A Tilt-Shift effect on your image gives it the impression that the subject is actually a scale model. It does this by dramatically simulating a shallow Depth of Field along with an increase in the color saturation.</p>
<p><span id="more-769"></span></p>
<p>To get the best effect, it’s advisable to use an image that is looking down on your subject. An image such as a busy street scene viewed from a multi-story building or where the camera is above the horizon line, works perfectly. Alternatively, you can also <a title="Tilt-Shift original source image" href="http://maddisondesigns.com/wp-content/uploads/2010/02/tilt-shift_source-img.jpg" rel="lightbox_group">download the image</a> I’ve used in this tutorial.</p>
<h2>Step 1: Increasing the color saturation</h2>
<p>We’ll start off by increasing the color saturation. This makes the effect more noticeable.</p>
<p>After opening your image, create a new Vibrance Adjustment Layer. You can do this by selecting the half-filled circle at the bottom of your Layers palette or from the Layer &gt; New Adjustment Layer &gt; Vibrance&#8230; menu option. The amount you increase the Vibrance &amp; Saturation will depend on your particular image. For this image though, I’ve increased both to +40 to really exaggerate the colors.</p>
<p style="text-align: center;"><img class="size-full wp-image-775 aligncenter" title="tilt-shift_image1" src="http://maddisondesigns.com/wp-content/uploads/2010/02/tilt-shift_image1.jpg" alt="" width="550" height="588" /></p>
<h2>Step 2: Adjusting the curves</h2>
<p>Next, add a new Curves adjustment layer. Again, you can select this from the half-filled circle at the bottom of the Layers palette or from the Layer &gt; New Adjustment Layer &gt; Curves&#8230; menu option. Increase the highlights and decrease the shadows slightly to provide further contrast between the colors. The amount of adjustment required in the curves dialog may vary depending on the particular image used.</p>
<p style="text-align: center;"><img class="size-full wp-image-776 aligncenter" title="tilt-shift_image2" src="http://maddisondesigns.com/wp-content/uploads/2010/02/tilt-shift_image2.jpg" alt="" width="550" height="588" /></p>
<h2>Step 3: Simulate the depth of field</h2>
<p>The main effect in a Tilt-Shift image is the shallow depth of field. To simulate this, we first need to blur the image. Select your background layer (or the layer that has your image) and press Ctrl-J (Command-J on Mac) to duplicate this layer. If it’s not already, select this new duplicated layer and then select Filter &gt; Blur &gt; Gaussian blur&#8230; menu option. Blur your image with a Radius of 4.5 pixels.</p>
<p style="text-align: center;"><img class="size-full wp-image-777 aligncenter" title="tilt-shift_image3" src="http://maddisondesigns.com/wp-content/uploads/2010/02/tilt-shift_image3.jpg" alt="" width="550" height="588" /></p>
<p>With your blurred layer still selected, add a new Layer Mask by selecting the Add Layer Mask icon at the bottom of the Layers palette or by selecting the Layer &gt; Layer Mask &gt; Reveal All menu option. Make sure your Layer mask (not the image) is selected by clicking on it. Select the Gradient Tool and in the options palette, select Reflected Gradient (4th Gradient icon from the left). Also, ensure that the &#8216;Reverse&#8217; checkbox is unticked. Next, drag the gradient vertically over a small portion of the image. To make sure it’s perfectly vertical, hold down the Shift key while you drag. What you are doing here is creating a mask on the blurred image so that the original image sitting on the layer below, can be seen. Since we only want to simulate a narrow Depth of Field, the gradient should be quite small. It may take a couple of goes to get the correct effect. Once you’ve added your gradient to the Layer mask, you should find that the area you dragged the cursor over will no longer be blurred.</p>
<p style="text-align: center;"><img class="size-full wp-image-778 aligncenter" title="tilt-shift_image4" src="http://maddisondesigns.com/wp-content/uploads/2010/02/tilt-shift_image4.jpg" alt="" width="550" height="588" /></p>
<h2>Step 4: Fine tune your image</h2>
<p>To ‘fine tune’ your gradient, click the small “link” icon between the image and the Layer mask (in the Layers palette) to turn it off. Making sure your Layer mask is still selected, select the Move Tool and use the Up &amp; Down arrow keys to fine tune the position of your mask. The subject matter of your image will influence where best to position the mask to get the best effect.</p>
<p style="text-align: center;"><img class="size-full wp-image-779 aligncenter" title="tilt-shift_image5" src="http://maddisondesigns.com/wp-content/uploads/2010/02/tilt-shift_image5.jpg" alt="" width="550" height="588" /></p>
<h2>Step 5: Grab a coffee</h2>
<p>Once you’re happy with the placement of your mask, your image is complete. You can now sit back and contemplate what you’re going to “miniaturise” next <img src='http://maddisondesigns.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p style="text-align: center;"><a title="Completed Tilt-Shift effect" href="http://maddisondesigns.com/wp-content/uploads/2010/02/tilt-shift_completed.jpg"><img class="aligncenter size-full wp-image-774" title="Completed Tilt-Shift effect" src="http://maddisondesigns.com/wp-content/uploads/2010/02/tilt-shift_completed-sml.jpg" alt="Completed Tilt-Shift effect" width="550" height="366" /></a></p>
<p>I’ve also published this tutorial on <a title="The Web Squeeze" href="http://www.thewebsqueeze.com/web-design-tutorials/creating-a-tilt-shift-effect-using-photoshop.html">The Web Squeeze</a>.</p>
<p><a class="noborder" title="The Web Squeeze" href="http://www.thewebsqueeze.com/web-design-tutorials/creating-a-tilt-shift-effect-using-photoshop.html"><img class="size-full wp-image-771" title="The Web Squeeze" src="http://maddisondesigns.com/wp-content/uploads/2010/02/img_the-web-squeeze.jpg" alt="" width="385" height="76" /></a></p>
<p>If you found this tutorial interesting I&#8217;d love to hear so please leave a comment. Thanks. <img src='http://maddisondesigns.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://maddisondesigns.com/2010/02/creating-a-tilt-shift-effect-using-photoshop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

