<?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>Pixels &#38; Bikes &#187; Pixels and Bikes</title>
	<atom:link href="http://pixelsandbikes.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://pixelsandbikes.com</link>
	<description></description>
	<lastBuildDate>Thu, 15 Mar 2012 20:28:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Responsive Web Design: The Big Picture</title>
		<link>http://pixelsandbikes.com/2012/01/28/responsive-web-design-the-big-picture/</link>
		<comments>http://pixelsandbikes.com/2012/01/28/responsive-web-design-the-big-picture/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 23:05:32 +0000</pubDate>
		<dc:creator>Ally Noormohamed</dc:creator>
				<category><![CDATA[Pixels]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[responsive website design]]></category>
		<category><![CDATA[website design]]></category>

		<guid isPermaLink="false">http://pixelsandbikes.com/?p=383</guid>
		<description><![CDATA[<div class="Introduction">
<blockquote>Responsive Web Design isn't a silver bullet for mobile Web experiences. Not only does client-side adaptation require a careful approach, but it can also be difficult to optimize source order, media, third-party widgets, URL structure, and application design within a RWD solution. <cite>- <a href="http://www.lukew.com/about/index.asp">Luke Wroblewski</a>, Digital Product Design Leader, Entrepreneur and Author/Speaker</cite></blockquote>

<p> Innovations in smart phones and tablets have changed the mobile landscape introducing new challenges in design and development. </p>
</div]]></description>
			<content:encoded><![CDATA[<div class="Introduction">
<blockquote><p>Responsive Web Design isn&#8217;t a silver bullet for mobile Web experiences. Not only does client-side adaptation require a careful approach, but it can also be difficult to optimize source order, media, third-party widgets, URL structure, and application design within a RWD solution. <cite>- <a href="http://www.lukew.com/about/index.asp">Luke Wroblewski</a>, digital product design leader, entrepreneur and author/speaker</cite></p></blockquote>
</div>
<p>Innovations in smart phones and tablets have changed the mobile landscape introducing new challenges in design and development. <a href="http://www.alistapart.com/articles/responsive-web-design/">Ethan Marcotte</a> proposed a solution by morphing fluid designs to create responsive website design. Its a milestone in web evolution but we recognize that its <a href="http://stephanierieger.com/on-designing-content-out-a-response-to-zeldman-and-others/">not a perfect solution</a>.</p>
<p>People continue to experiment to discover it full potential and fix its imperfections. Experiments however seem to be focused on <a href="http://mediaqueri.es/">layout manipulation</a> (based on break points using media queries). Simple layout manipulation is fine for smaller sites with smaller payloads but larger sites will require more forethought and development for responsive design to work.</p>
<p>I’m sure many brilliant solutions were built for the <a href="http://filamentgroup.com/lab/introducing_the_new_responsive_designed_bostonglobecom/">Boston Globe</a> but consider the complexities of sites such as <a href="http://alibaba.com/">alibaba.com</a> or <a href="http://ebay.ca/">eBay.ca</a>. There is performance of content management systems, integration with third party API’s, integration with legacy systems and more. Lets combine that with multiple device constraints, maintainability and scalability.</p>
<blockquote><p>We now take our content management systems for granted, but it wasn’t always this easy for the desktop web. We forget how difficult it was to simply get Apache running properly. During the last big wave of technology, we had a lot of infrastructure to build before we could reliably deliver quality experiences for desktop browsers. We’ve got a similar road ahead when it comes to mobile. <cite>- <a href="http://userfirstweb.com/about/">Jason Grigsby</a>, mobile evangelist and web strategist</cite></p></blockquote>
<p>I’m sure there are smart people working to solve these issues as I write this. I hope we can use those solutions to get beyond simple trickery to master wizardry.</p>
<h2>About The Author</h2>
<div class="article-author">
<div class="author-avatar"><a title="Ally Noormohamed" href="http://www.anom.ca/?from=pandb"><img src="http://pixelsandbikes.com/wp-content/uploads/2011/12/web_small_IMG_9601-1.jpg" alt="Ally Noormohamed" /></a></div>
<div class="author-bio">
<h4><a title="Ally Noormohamed" href="http://www.anom.ca/?from=pandb">Ally Noormohamed</a></h4>
<p>Ally is a UI/UX designer, illustrator and writer. He loves creating for the web, it’s the little things, the details that are often overlooked that he loves.</p>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://pixelsandbikes.com/2012/01/28/responsive-web-design-the-big-picture/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Design Choices: Building a Better Home Page</title>
		<link>http://pixelsandbikes.com/2011/12/15/design-choices-building-a-better-home-page/</link>
		<comments>http://pixelsandbikes.com/2011/12/15/design-choices-building-a-better-home-page/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 16:14:42 +0000</pubDate>
		<dc:creator>Ally Noormohamed</dc:creator>
				<category><![CDATA[Pixels]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[re-design]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://pixelsandbikes.com/?p=319</guid>
		<description><![CDATA[<div class="Introduction">
<h3>I buy flowers and gifts for family and friends from an online retailer called <a href="http://www.bloomex.ca/">Bloomex</a>. I always start on their home page to try and locate an item within my price range.  This task takes more time than it should because the site fails to address basic usability. </h3>
</div>

<img src="http://pixelsandbikes.com/wp-content/uploads/2011/12/tag-line1.png" alt="Re-design screenshot" width="612" height="300" class="ImgAlignCenter" />

In this article I will explain my solution and hope to emphasize the importance of making design decisions using proven usability practices and design fundamentals. Lets not forget common sense]]></description>
			<content:encoded><![CDATA[<div class="Introduction">
<h3>I buy flowers and gifts for family and friends from an online retailer called <a href="http://www.bloomex.ca/">Bloomex</a>. I always start on their home page to try and locate an item within my price range.  This task takes more time than it should because the site fails to address basic usability.</h3>
</div>
<p>I continue to shop from them because their products and service are great but that is not reflected on the site.</p>
<blockquote><p>Appearance can greatly influence perceptions, and we carry that mental model with us when sizing up a website” <cite>– <a href="http://aarronwalter.com/">Aaron Walters</a>, lead UX Designer for <a href="http://aarronwalter.com/">Rocket Science Group</a></cite></p></blockquote>
<p>Improving the home page would be a good start so I decided to propose<a title="Proposed redesign of Bloomex home page" href="http://pixelsandbikes.com/wp-content/uploads/2011/12/1-bloomex-home.png" rel="lightbox[319]"> one possible solution</a>. In this article I will explain my solution and hope to emphasize the importance of making design decisions using proven usability practices and design fundamentals. Lets not forget common sense.</p>
<h2>Navigation</h2>
<p><a href="http://pixelsandbikes.com/wp-content/uploads/2011/12/partial-home-page1.png" rel="lightbox[319]"><img class="alignnone size-full wp-image-343" title="Screen shot of Bloomex home page" src="http://pixelsandbikes.com/wp-content/uploads/2011/12/partial-home-page1.png" alt="Screen shot of Bloomex home page" width="612" height="528" /></a></p>
<p>The primary navigation is disjointed and buried under the banner. It is most effective adjacent to the main content area. The option for policies is rarely a first choice for people so I grouped it with other like items in the footer. Help can be grouped with other support information (e.g. phone number) and specials can be expanded within the main content area.</p>
<p>A Google search of similar online stores shows common navigation choices for product categories are flowers and plants, and gift baskets. Providing links for about the company and contact information establishes credibility and trust with the company. These options combine to form a navigation that is easy and familiar for people.</p>
<p><a href="http://pixelsandbikes.com/wp-content/uploads/2011/12/navigation1.png" rel="lightbox[319]"><img class="alignnone size-full wp-image-342" title="Redesigned navigation for Bloomex website" src="http://pixelsandbikes.com/wp-content/uploads/2011/12/navigation1.png" alt="Redesigned navigation for Bloomex website" width="612" height="93" /></a></p>
<h2>Site Utilities and Support Information</h2>
<p>It’s important to group like items together such as phone number, live support and help for people to see the similarities, and differences between items. People often lean on search to find what they are looking so I made it larger and relocated it to the top right. I placed the groups at the top of the page because they are often found there on many sites (e.g. eBay and Amazon). Familiarity is usability.</p>
<p><a href="http://pixelsandbikes.com/wp-content/uploads/2011/12/site-utilities1.png" rel="lightbox[319]"><img class="alignnone size-full wp-image-344" title="Redesigned site utilities for Bloomex website" src="http://pixelsandbikes.com/wp-content/uploads/2011/12/site-utilities1.png" alt="Redesigned site utilities for Bloomex website" width="612" height="94" /></a></p>
<h2>Content</h2>
<p>The content does little to communicate the site’s purpose or summarize what the company does. The banner ad is a partial attempt to convey that but many people ignore ads or elements resembling an ad. Revealing a selection of gifts provides a good insight to their products. People will glance for keywords so I accommodate the behavior by providing emphasis on content such as the tag line, titles and links.</p>
<p><a href="http://en.wikipedia.org/wiki/Hick%27s_law">Hick’s law of design principle</a> states that the time it takes to make a decision increases with the number of alternatives. By limiting the tasks to a handful of choices there is clear starting point for people.</p>
<p><a href="http://pixelsandbikes.com/wp-content/uploads/2011/12/main-content1.png" rel="lightbox[319]"><img class="alignnone size-full wp-image-341" title="Redesigned content area for Bloomex home page" src="http://pixelsandbikes.com/wp-content/uploads/2011/12/main-content1.png" alt="Redesigned content area for Bloomex home page" width="612" height="487" /></a></p>
<p>Shipping, weekly specials and creating your own are ideal choices for valuable tasks on the home page. Bloomex attempts to highlight those choices throughout the site.</p>
<p>The footer can be utilized for additional content and content that doesn’t require prominence. Bloomex packs the footer with SEO content much of which can be accomplished with better content on pages such as meta information.</p>
<p><a href="http://pixelsandbikes.com/wp-content/uploads/2011/12/footer1.png" rel="lightbox[319]"><img class="alignnone size-full wp-image-340" title="Redesigned footer for Bloomex website" src="http://pixelsandbikes.com/wp-content/uploads/2011/12/footer1.png" alt="Redesigned footer for Bloomex website" width="612" height="134" /></a></p>
<h2>Design</h2>
<p>Visual design influences usability.</p>
<blockquote><p>It’s shown that beautiful design creates a positive response in the brain, which actually improves our cognitive abilities” <cite>– <a href="http://www.jnd.org/bio-sketch.html">Donald Norman</a>, cofounder of the <a href="http://www.nngroup.com/">Nielsen Norman Group</a></cite></p></blockquote>
<p>I started by refreshing the existing color palette to provide better contrast and elegance, combined with appropriate white space and borders establishes a harmonious theme.</p>
<p><a href="http://pixelsandbikes.com/wp-content/uploads/2011/12/COLOURlovers.com-Elegance.png" rel="lightbox[319]"><img class="alignnone size-full wp-image-326" title="New color scheme for Bloomex website" src="http://pixelsandbikes.com/wp-content/uploads/2011/12/COLOURlovers.com-Elegance.png" alt="New color scheme for Bloomex website" width="390" height="117" /></a></p>
<p>The theme is not complete without typography. Though Verdana has stood the test of time we now have more options for legible and attractive fonts. I picked two contrasting fonts for emphasis between the tag line (Candara) and other text (Open Sans). Variations in other text can be accommodated by ten different options of Open Sans.</p>
<p><a href="http://pixelsandbikes.com/wp-content/uploads/2011/12/tag-line1.png" rel="lightbox[319]"><img class="alignnone size-full wp-image-345" title="Revised tag line for Bloomex home page" src="http://pixelsandbikes.com/wp-content/uploads/2011/12/tag-line1.png" alt="Revised tag line for Bloomex home page" width="612" height="300" /></a></p>
<p>I added icons to create visual cues and enhance content presentation.</p>
<p><a href="http://pixelsandbikes.com/wp-content/uploads/2011/12/icons.png" rel="lightbox[319]"><img class="alignnone size-full wp-image-328" title="New icons for Bloomex website" src="http://pixelsandbikes.com/wp-content/uploads/2011/12/icons.png" alt="New icons for Bloomex website" width="442" height="367" /></a></p>
<p>Images would have been an alternative. Instead I use them in the carousel, which is the replacement for the banner ad and revealing deeper richer content at a glance. I use a (960) grid to group the elements and widen the layout to complete the harmony.</p>
<p><a href="http://pixelsandbikes.com/wp-content/uploads/2011/12/1-bloomex-home1.png" rel="lightbox[319]"><img class="alignnone size-full wp-image-338" title="Redesigned home page for Bloomex website" src="http://pixelsandbikes.com/wp-content/uploads/2011/12/1-bloomex-home1.png" alt="Redesigned home page for Bloomex website" width="612" height="744" /></a></p>
<h2>What about Mobile?</h2>
<blockquote><p>To have a successful mobile site or app, the obvious guideline is to design for the small screen. Sadly, some don&#8217;t, and we still see users struggle to hit tiny areas that are much smaller than their fingers. The fat-finger syndrome will be with us for years to come.  The second point is more conceptual — and harder for some people to accept: When you have a smaller screen, you must limit the number of features to those that matter the most for the mobile use case” <cite>– <a href="http://www.useit.com/jakob/">Jacob Nielson</a>, usability expert.</cite></p></blockquote>
<p>I considered these and other mobile usability guidelines when I started to ensure my solution would be scalable for mobile devices. Mobile is no longer an after thought.</p>
<p><a href="http://pixelsandbikes.com/wp-content/uploads/2011/12/1-bloomex-home-iphone.png" rel="lightbox[319]"><img class="alignnone size-full wp-image-336" title="Mobile view of Bloomex home page" src="http://pixelsandbikes.com/wp-content/uploads/2011/12/1-bloomex-home-iphone.png" alt="Mobile view of Bloomex home page" width="255" height="490" /></a></p>
<h2>Closing Remarks</h2>
<p>Before I started I thought about a <a href="http://www.alistapart.com/articles/redesignrealign/">realign instead of a redesign</a> to fix the fundamental flaws but visual design was part of the issue. Using sound principles I looked at individual components and restructured for a better user experience. Its easy to leap to Photoshop first but that only provides a temporary solution.</p>
<h2>About The Author</h2>
<div class="article-author">
<div class="author-avatar"><a title="Ally Noormohamed" href="http://www.anom.ca/?from=pandb"><img src="http://pixelsandbikes.com/wp-content/uploads/2011/12/web_small_IMG_9601-1.jpg" alt="Ally Noormohamed" /></a></div>
<div class="author-bio">
<h4><a title="Ally Noormohamed" href="http://www.anom.ca/?from=pandb">Ally Noormohamed</a></h4>
<p>Ally is a UI/UX designer, illustrator and writer. He loves creating for the web, it’s the little things, the details that are often overlooked that he loves.</p>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://pixelsandbikes.com/2011/12/15/design-choices-building-a-better-home-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yes, you can ride your bike to work in winter</title>
		<link>http://pixelsandbikes.com/2011/11/21/yes-you-can-ride-your-bike-to-work-in-winter/</link>
		<comments>http://pixelsandbikes.com/2011/11/21/yes-you-can-ride-your-bike-to-work-in-winter/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 07:51:52 +0000</pubDate>
		<dc:creator>Dave Arthur</dc:creator>
				<category><![CDATA[Bikes]]></category>
		<category><![CDATA[bike commuting]]></category>
		<category><![CDATA[bike skills]]></category>
		<category><![CDATA[riding tips]]></category>
		<category><![CDATA[winter riding]]></category>

		<guid isPermaLink="false">http://pixelsandbikes.com/?p=263</guid>
		<description><![CDATA[<div class="Introduction">
<h3>I must admit. I love strolling into my office building’s elevator in the morning completely soaked, holding my travel mug with a smile on my face. You may have seen one of these creatures at your workplace. Apparently we are a strange breed!</h3>
</div>

<img src="http://pixelsandbikes.com/wp-content/uploads/2011/12/snow-cruiser2.jpg" alt="snowy cruiser" width="612" height="408" class="ImgAlignCenter" />
<p class="FigCaption AlignRight">Photo: <a href="http://www.flickr.com/photos/winstonavich/4316704482/">Winston Hearn</a></p>
Bike commuting is possible all year round. I’ve lived in three different cities with three different climates and rode through drenching rain, ice, deep snow and frigid temperatures.

In the this article, I share a few gear and riding tips which I found have helped me through many sketchy weather conditions]]></description>
			<content:encoded><![CDATA[<div class="Introduction">
<h3>I must admit. I love strolling into my office building’s elevator in the morning completely soaked, holding my travel mug with a smile on my face. You may have seen one of these creatures at your workplace. Apparently we are a strange breed!</h3>
</div>
<p><img src="http://pixelsandbikes.com/wp-content/uploads/2011/12/snow-cruiser2.jpg" alt="snowy cruiser" width="612" height="408" class="ImgAlignCenter" /></p>
<p class="FigCaption AlignRight">Photo: <a href="http://www.flickr.com/photos/winstonavich/4316704482/">Winston Hearn</a></p>
<p>Bike commuting is possible all year round. I’ve lived in three different cities with three different climates and rode through drenching rain, ice, deep snow and frigid temperatures.</p>
<p>In this article, I share a few gear and riding tips which I found have helped me through many sketchy weather conditions.</p>
<h2>Go Mountain Biking</h2>
<div class="FigureFloats VisualClear"><img class="ImgAlignLeft Figure" src="http://pixelsandbikes.com/wp-content/uploads/2011/11/bike-fork-in-trail-2.jpg" alt="Mt. Seymour - fork in trail at bottom of Ned's" width="275" height="376" /><img class="ImgAlignLeft Figure" src="http://pixelsandbikes.com/wp-content/uploads/2011/11/overhead-bike-2.jpg" alt="Mt. Seymour ladder bridges " width="275" height="376" /></div>
<p>I highly recommend getting into mountain biking during the summer. I am extremely fortunate to live close to the <a href="http://nsmba.ca/">North Vancouver trail system</a> (North Shore) which offers some very challenging riding conditions. Here, we ride <em>rain or shine</em> and I find my wet weather riding skills come in hand for winter commuting. Mountain biking teaches balance and stability, how to navigate obstacles, how to ride a wide variety of conditions including wet and muddy conditions, and teaches you how to fall properly.</p>
<h2>Leave early and don’t over-react</h2>
<p>Like drivers, bike commuters should give themselves a little extra time to get to work in adverse conditions. In Vancouver, I find that the road conditions vary all over my route. At my house the roads could be fine, while further down my route I could experience icy or water-logged areas. Taking some extra time can help ensure a safe ride.</p>
<p>Also akin to driving, it’s important not to over-react to the conditions. While some may disagree, I tell people that <a href="http://www.mec.ca/Main/home.jsp?bmForm=mec_quick_search&amp;bmFormID=jeZhKAc&amp;bmUID=jeZhKAd&amp;bmIsForm=true&amp;bmPrevTemplate=%2FMain%2Fhome.jsp&amp;bmText=quick_search&amp;quick_search=snow+tires&amp;bmImage=search.x&amp;bmImage=search.y&amp;bmImage=search&amp;search.x=0&amp;search.y=0">snow (studded) tires</a> are not necessary for riding snowy conditions. Just keeping a steady pace in snow or slush and making wide turns will get you through. Likewise, in slippy or icy conditions I keep my pace steady and if I experience some slipping, I just make a small correction to my body positioning.</p>
<p>Finally, trust your fears. If you don’t feel safe going down a hill which looks icy, better to walk it. Although that can be tough sometimes.</p>
<h2>Don’t be lazy. Maintenance your bike regularly</h2>
<p>I’ll admit. This is probably the hardest thing for me to follow. Having a busy family and work life usually means that bike maintenance sessions end up being few and far between. But you are better than me right? Of course you are!</p>
<div class="FigureFloats VisualClear"><img class="ImgAlignLeft Figure" src="http://pixelsandbikes.com/wp-content/uploads/2011/11/worn-brake-pads.jpg" alt="Worn brake pads" width="275" height="376" /><img class="ImgAlignLeft Figure" src="http://pixelsandbikes.com/wp-content/uploads/2011/11/rim-groove.jpg" alt="rim with groove" width="275" height="376" /></div>
<p>Case in point. Above you can see that my laziness led to overly worn brake pads. The brake pads wore unevenly leading to a metal part of the pad housing digging into my rim. This caused a nice deep groove in my rim which will need to eventually be replaced&#8230;once I get around to it.</p>
<p>Seriously though, regular maintenance of the core areas of wear will prevent accidents and costly bike repairs. The amount of maintenance will depend on your bike type. One of the reasons I ride a <a href="http://www.bikegurus.com/2010/08/trek-soho-s-ride-experience.html">single speed urban bike</a> is because it requires lower maintenance than other bikes. The lack of derailleur means I only need to change the chain and brake pads most of the time. Once a year I usually re-route my cables and housing.</p>
<h2>Dress accordingly</h2>
<p>To me layering is an art form which I’ll admit took me a long time to nail down.</p>
<p>When I lived in Edmonton riding in winter meant braving -20°C or so weather (with much much colder windchills!). For the top I usually wore a tight fitting long sleeved synthetic undershirt followed by a thin sweatshirt followed by a GORE-TEX&reg; jacket (shell). On the bottom, long johns and outer shell pants. Since I didn’t have any fleece, the first 5 minutes were uncomfortably cold. However, once I got through those 5 minutes and worked up some heat I was quite comfortable.</p>
<p>In Vancouver, even though it’s warmer, I find myself using the same dressing principle. I wear the minimum amount of clothes to protect myself from the elements (rain and wind). I am uncomfortably cold for the first few minutes but then become more comfortable after I warm up. This strategy works for me because I <em>hate</em> sweating.</p>
<p>It may take a while but eventually you&rsquo;ll find a system that will work for you.</p>
<h2>Last Thoughts</h2>
<p>Well, I hope I have shown you that commuting by bike <em>is</em> possible during winter. By practicing your riding skills, reacting accordingly to the conditions, regularly maintaining your bike and dressing appropriately, riding in winter can be fun (yes I said it!). You will also command some serious respect in the workplace. <img src='http://pixelsandbikes.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><em>Have a tip? Please share your winter biking strategy in the comments below!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://pixelsandbikes.com/2011/11/21/yes-you-can-ride-your-bike-to-work-in-winter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Unique Sidebar Content for WordPress Pages using Custom Post Types</title>
		<link>http://pixelsandbikes.com/2011/10/01/creating-unique-sidebar-content-for-wordpress-pages-with-one-template-using-custom-post-types/</link>
		<comments>http://pixelsandbikes.com/2011/10/01/creating-unique-sidebar-content-for-wordpress-pages-with-one-template-using-custom-post-types/#comments</comments>
		<pubDate>Sun, 02 Oct 2011 02:45:27 +0000</pubDate>
		<dc:creator>Dave Arthur</dc:creator>
				<category><![CDATA[Pixels]]></category>
		<category><![CDATA[Custom Post Types]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://pixelsandbikes.com/?p=166</guid>
		<description><![CDATA[<div class="Introduction">
<h3>In this article, I show how to use Wordpress’ custom post functionality to create unique sidebar content blocks for static pages which run off the same template.</h3>

A non-profit organization I volunteer for recently requested a way to add contextual content to specific Wordpress page sidebars. The content could include quotes, donation and course banners and other images which were related to the content of the page.

The website has almost 100 static pages which use <em>page.php</em> as their template. The challenge was to find functionality which could provide page-specific sidebar content that could easily be administrated by volunteers who had a wide variety of technical backgrounds.

I usually try to provide custom functionality for my clients without resorting to Wordpress plugins. Don’t get me wrong, I love plugins for a lot of things such as displaying the latest tweets, optimizing SEO and displaying content via light boxes (all of which are used on this site). I just don’t always care for the excessive quantity of poorly outputted code which often accompanies the functionality.
</div>
]]></description>
			<content:encoded><![CDATA[<div class="Introduction">
<h3>In this article, I show how to use WordPress’ custom post functionality to create unique sidebar content blocks for static pages which run off the same template.</h3>
<p>A non-profit organization I volunteer for recently requested a way to add contextual content to specific WordPress page sidebars. The content could include quotes, donation and course banners and other images which were related to the content of the page.</p>
<p>The website has almost 100 static pages which use <em>page.php</em> as their template. The challenge was to find functionality which could provide page-specific sidebar content that could easily be administrated by volunteers who had a wide variety of technical backgrounds.</p>
<p>I usually try to provide custom functionality for my clients without resorting to WordPress plugins. Don’t get me wrong, I love plugins for a lot of things such as displaying the latest tweets, optimizing SEO and displaying content via light boxes (all of which are used on this site). I just don’t always care for the excessive quantity of poorly outputted code which often accompanies the functionality.</p>
<h2>Overview of Steps Involved</h2>
<ol>
<li><a href="#section1">Register a Sidebar custom post type</a></li>
<li><a href="#section2">Create a template include file for the sidebar content block</a></li>
<li><a href="#section3">Include the new sidebar template file in <em>sidebar.php</em></a></li>
<li><a href="#section4">Create a sidebar entry</a></li>
<li><a href="#section5">Add the sidebar entry to the WordPress static page</a></li>
</ol>
</div>
<h2 id="section1">1. Register a Sidebar Custom Post Type</h2>
<p>In <em>functions.php</em> we would use the <code><a href="http://codex.wordpress.org/Function_Reference/register_post_type">register_post_type</a></code> WordPress function to create the sidebar content post type.</p>
<pre class="php">&lt;?php

add_action( 'init', 'create_post_type' );

function create_post_type() {

$labels = array(
    	'name' =&gt; __('Sidebar Content'),
    	'singular_name' =&gt; __('Sidebar Entry'),
    	'add_new' =&gt; __('Add New'),
    	'add_new_item' =&gt; __('Add New Sidebar Entry'),
    	'edit_item' =&gt; __('Edit Sidebar Entry'),
    	'new_item' =&gt; __('New Sidebar Entry'),
    	'view_item' =&gt; __('View Sidebar Entry'),
    	'search_items' =&gt; __('Search Sidebar Entry'),
    	'not_found' =&gt;  __('No Sidebar Entry found'),
    	'not_found_in_trash' =&gt; __('No Sidebar Entry found in Trash'),
    	'parent_item_colon' =&gt; ''
      );

$args = array(
    	'labels' =&gt; $labels,
    	'public' =&gt; true,
    	'publicly_queryable' =&gt; true,
    	'show_ui' =&gt; true,
    	'query_var' =&gt; true,
    	'rewrite' =&gt; true,
    	'capability_type' =&gt; 'post',
    	'hierarchical' =&gt; true,
    	'menu_position' =&gt; null,
    	'supports' =&gt; array('title','editor','author', 'page-attributes', 'revisions')
      );

      register_post_type('sidebar-content',$args);

}

?&gt;</pre>
<p>In the code we have the function <code>create_post_type</code> which runs at WordPress initialization. Inside the <code>create_post_type</code> function we have the <code>register_post_type</code> function which accepts two arguments: a post type name and an array of arguments (<code>$arg</code>).</p>
<p>I’m not going to go into the details of the <code>register_post_type</code> function or it’s arguments as there is an excellent <a href="http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress">in depth article</a> by Justin Tadlock explaining the function details.</p>
<p>Most of the values in the <code>$args</code> array are defaults. One exception is the <code>supports</code> argument which defines the post admin features (meta boxes, editors, etc) which will be available for the new post type. Here I only need the title, (WYSIWYG) editor, author, page attributes (parent and order) and revisions boxes. There are <a href="http://codex.wordpress.org/Function_Reference/register_post_type">many more options</a> so feel free to add more to suit your needs.</p>
<p>Inside the arguments is the <code>$labels</code> array which contains strings that will be used to label the sidebar content admin area.</p>
<p id="Figure1" class="Figure"><img class="ImgAlignCenter" src="/wp-content/uploads/2011/10/entry001-1a.jpg" alt="Screenshot of WordPress admin area for adding new sidebar entry.  Highlighted are the labels defined in the $labels array" width="615" height="324" /></p>
<p class="FigCaption">Screenshot of WordPress admin area for adding new sidebar entry. Highlighted are the labels defined in the $labels array</p>
<h2 id="section2">2. Create a Template Include File for the Sidebar Content Block</h2>
<p>Next we&#8217;ll create a new PHP include file which will generate the sidebar content. I’m going to call the file <em>custom-sidebar-content.php</em> and put it in an <em>includes</em> folder for better organization.</p>
<pre class="php">&lt;?php 

/* PART 1: Get the page ID and store in $postID variable */ 

$postID = $post-&gt;ID;

/* PART 2: For that page, get the 'sidebar-post-id' custom field value */

$sidebarID = get_post_meta($postID, 'sidebar-entry-id', true);

/* PART 3: If a value is returned set up a WP query to retrieve content of Custom sidebar post */

if ($sidebarID) {

    $sidebarEntryArgs = array (

   	 'post_type' =&gt; 'sidebar-content',
   	 'post__in' =&gt; array ( $sidebarID )

    );

    $sidebarQuery = new WP_Query($sidebarEntryArgs);

    if ( $sidebarQuery-&gt;have_posts() ) :

   	 while ( $sidebarQuery-&gt;have_posts() ) : $sidebarQuery-&gt;the_post();

   		 $sidebarContent = get_the_content();  /* get the content of the post - what ever is in WYSIWYG editor box and store in variable for output below */

   	 endwhile;

    endif;

    wp_reset_query();

}

/* Part 4: Output the sidebar code in a container with classes for CSS */

if ($sidebarContent) {

?&gt;

&lt;div&gt;

   &lt;?php echo $sidebarContent; ?&gt;
   
&lt;/div&gt;

&lt;?php } ?&gt;</pre>
<p>I have split the code above into 4 parts which are commented.</p>
<p>The first part retrieves the ID of the current WordPress page storing it in the <code>$postID</code> variable.</p>
<p>In the second part we use the page ID to retrieve a <a href="http://codex.wordpress.org/Custom_Fields">custom field</a> value. Each static page which contains custom sidebar content will have a custom field named “sidebar-entry-id”. The value of the custom field will be the ID of the sidebar entry we want to include on the page.</p>
<p>Here we use the <code><a href="http://codex.wordpress.org/Function_Reference/get_post_meta">get_post_meta</a></code> function which accepts three parameters. The first is the post ID (in our case the page ID). The second is the custom field name (“sidebar-entry-id” in our case). The third is a boolean value asking if we want to return a single string (true) or an array of custom field values (false). In this case we only want to include one sidebar ID so we will stick with true.</p>
<p>We have now used the page ID to retrieve the sidebar entry ID which we will use to bring in the sidebar entry content to the page.</p>
<p>In the third part of the script we are creating a new <a href="http://codex.wordpress.org/Class_Reference/WP_Query">WP_Query</a> object to retrieve the associated sidebar entry content. First we check if we have a sidebar ID value returned from <code>get_post_meta</code> function. If so we use the value in the query arguments, <code>$sidebarEntryArgs</code>. In addition to specifying the sidebar entry ID, we also specify the post type which is “sidebar-content”. Within the loop we use the function <code><a href="http://codex.wordpress.org/Function_Reference/get_the_content">get_the_content</a></code> to retrieve the content of the WYSIWYG editor for the sidebar entry and store it in the <code>$sidebarContent</code> variable.</p>
<p>Finally, in part 4, we output the sidebar entry content within a div which has classes for styling the content with CSS. I use the class “CustomSidebar” to style anything specific to the container and the class “entry” to style the contents.</p>
<h2 id="section3">3. Include the new sidebar template file in <em>sidebar.php</em></h2>
<p>The next step is pretty straightforward. Open up <em>sidebar.php</em> or another sidebar file and paste in the following PHP code where the sidebar content will be outputted.</p>
<pre class="php">    &lt;?php require_once('includes/custom-sidebar-content.php') ?&gt;</pre>
<p>Again, I put the <em>custom-sidebar-content.php</em> file in an includes folder. You may need to adjust the path of the included file.</p>
<p>At this point we have all the architecture for bringing in the sidebar content to the page. In the next two steps well will create some content for a sidebar entry and add it to the sidebar of a specific static page.</p>
<h2 id="section4">4. Create a sidebar entry</h2>
<p>Now we need to sign into WordPress and create a sidebar entry. From the dashboard you should see a left menu item called “Sidebar Content” (<a href="#Figure1">see figure above</a>). If you click the menu option you will see “Add New”. Clicking on this will bring you to a new entry page.</p>
<p>For this demo we will use the WYSIWYG visual editor to add some simple content: An <code>h3</code> heading and an unordered list.</p>
<p id="Figure3" class="Figure"><img class="ImgAlignCenter" src="http://pixelsandbikes.com/wp-content/uploads/2011/10/entry001-4b.jpg" alt="Screenshot of the WYSIWYG editor on the example sidebar entry." width="612" height="269" /></p>
<p class="FigCaption">Screenshot of the WYSIWYG editor of an example sidebar entry.</p>
<p>You should be able to embed any kind of content including images, video embeds and text of course. You could also dive into the HTML tab and make some more complex widgets.</p>
<p>You can give the entry whatever title you want. It won’t be outputted so I suggest giving it a name which associates it with the page it will be on. For instance, if this was the beer page, I would give it “Beer page sidebar”</p>
<p>Publish the entry and after the page has been reloaded, note down the ID of the sidebar entry as you will need it in the next step. This will be in the URL on the edit page.</p>
<p id="Figure2" class="Figure"><img class="ImgAlignCenter" src="http://pixelsandbikes.com/wp-content/uploads/2011/10/entry001-2a.jpg" alt="The location of the sidebar post ID" width="612" height="169" /></p>
<p class="FigCaption">Screenshot of the sidebar entry edit page. The entry ID is highlighted in the URL.</p>
<p><a href="http://pixelsandbikes.com/sidebar-content/example-beer-page-sidebar/">View the completed sidebar entry</a></p>
<h2 id="section5">5. Add the sidebar entry to the WordPress static page</h2>
<p>Finally, edit the page which will contain the custom sidebar content. Remember, the page template should have a <em>sidebar.php</em> (or equivalent) which includes <em>custom-sidebar-content.php</em> (<a href="#section3">step 3</a>).</p>
<p>On the edit page, scroll down to the custom fields box. Under the “name” field, enter “sidebar-entry-id”. In the “value” field enter the sidebar entry ID you noted in the previous step. Click “Add Custom Field” and update the page.</p>
<p id="Figure4" class="Figure"><img class="ImgAlignCenter" src="http://pixelsandbikes.com/wp-content/uploads/2011/10/entry001-3a.jpg" alt="Screenshot of custom fields box on sidebar entry edit page and filled in fields." width="612" height="244" /></p>
<p class="FigCaption">Screenshot of custom fields box while editing the static page.</p>
<p>Now if everything worked out the sidebar content should be visible on the static page.</p>
<p><a href="http://pixelsandbikes.com/examples/example-beer-page/">View the example static page with custom sidebar content</a></p>
<h2>Notes</h2>
<h3>Why I chose Custom Post Types</h3>
<p>Custom post types have been around since version 3.0. Since then, I’ve used custom posts to get around a number of problems in WordPress.</p>
<p>I really like how one can tailor the custom post admin to the type of content. For example, instead of having to call a content type a “post” which is far too generic, it can be called “Slide”, “Movie” or “Listing”. Calling a content type something other than post doesn’t really matter to WordPress developers, but it makes a big difference to a client or the person who will be administrating the website.</p>
<p>The website of the non-profit organization I designed this system for also has a blog so I didn’t want entries for sidebar content mixing with the blog items. I realize I could have used a normal post along with a specific category or tag as a filter but I didn’t want to have to modify the queries on the index.php, archives.php, and other archive pages. Using a custom post type automatically excludes it from the blog post listing. Also, adding the category or tag is another step in the process of creating a sidebar entries. I wanted to keep it as simple as possible.</p>
<h3>Limitations</h3>
<p>As I mentioned this demo is tailored to adding custom sidebar content to static pages. However, I will try to eventually make the code more general so single post pages and other archive pages can have custom sidebar content. In the meantime, please feel free to extend the technique.</p>
<h3>Generation of Custom Post Types</h3>
<p>It should be known that plugins exist which make it easier to register custom post types such as <a href="http://wordpress.org/extend/plugins/custom-post-type-ui/">Custom Post Type UI</a> by <a href="http://webdevstudios.com/">Brad Williams</a></p>
]]></content:encoded>
			<wfw:commentRss>http://pixelsandbikes.com/2011/10/01/creating-unique-sidebar-content-for-wordpress-pages-with-one-template-using-custom-post-types/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

