<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>dev7studios</title>
	
	<link>http://dev7studios.com</link>
	<description />
	<lastBuildDate>Thu, 27 May 2010 23:51:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/dev7studios" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="dev7studios" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Using Thumbnails with the Nivo Slider</title>
		<link>http://dev7studios.com/resource/using-thumbnails-with-the-nivo-slider/</link>
		<comments>http://dev7studios.com/resource/using-thumbnails-with-the-nivo-slider/#comments</comments>
		<pubDate>Thu, 27 May 2010 13:02:14 +0000</pubDate>
		<dc:creator>Gilbert</dc:creator>
				<category><![CDATA[Resource]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=186</guid>
		<description><![CDATA[In this tutorial I will show you how to set up and use thumbnails as the control navigation with the Nivo Slider. Search and Replace Thumbnails The default setting when using the controlNavThumbs setting in the Nivo Slider uses the controlNavThumbsSearch and controlNavThumbsReplace settings to generate the thumbnail url&#8217;s. Basically it takes the url for [...]]]></description>
			<content:encoded><![CDATA[<p>In this tutorial I will show you how to set up and use thumbnails as the control navigation with the <a href="http://nivo.dev7studios.com/">Nivo Slider</a>.</p>
<h3>Search and Replace Thumbnails</h3>
<p>The default setting when using the <code>controlNavThumbs</code> setting in the Nivo Slider uses the <code>controlNavThumbsSearch</code> and <code>controlNavThumbsReplace</code> settings to generate the thumbnail url&#8217;s. Basically it takes the url for each image, looks for whatever is defined in <code>controlNavThumbsSearch</code> (default &#8220;.jpg&#8221;) and replaces it with whatever is defined in <code>controlNavThumbsReplace</code> (default &#8220;_thumb.jpg&#8221;) and uses this new url for the thumbnail.</p>
<p>So for example if you have &#8220;images/slide1.jpg&#8221; as your image, the Nivo Slider script will generate the thumbnail url as &#8220;images/slide1_thumb.jpg&#8221;. This is the default functionality anyway and can be changed to your liking. So let&#8217;s see it in action. The HTML:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slider&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/up.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/monstersinc.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/nemo.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/walle.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Default HTML there. Nothing to worry about. Then we would use this setting in the Javascript:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#slider'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">nivoSlider</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    controlNavThumbs<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Finally the most important bit. The CSS required to make the thumbnails is where most people trip up (by default the thumbnail images are hidden):</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#slider</span> <span style="color: #6666ff;">.nivo-controlNav</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">-70px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Put the nav below the slider */</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#slider</span> <span style="color: #6666ff;">.nivo-controlNav</span> img <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Unhide the thumbnails */</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Note that these CSS styles will conflict with the &#8220;bullet&#8221; styles used in the &#8220;style-pack&#8221;. So only use one or the other, not both.</p>
<h3>Using the image &#8220;rel&#8221; Attribute</h3>
<p>The other option when using thumbnails with the Nivo Slider (v2.0+) is to use the <code>controlNavThumbsFromRel</code> setting. This simply generates the thumbnail url from the &#8220;rel&#8221; attribute in your images. So for exmaple:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slider&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/up.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/up_thumb.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/monstersinc.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/monstersinc_thumb.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/nemo.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/nemo_thumb.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/walle.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/walle_thumb.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Then in your Javascript you would do the following:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#slider'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">nivoSlider</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    controlNavThumbs<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
    controlNavThumbsFromRel<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now you can have even more control over your thumbnails. Note that the CSS above applies for both ways of using thumbnails.</p>
<h3>Conclusion</h3>
<p>So that&#8217;s how you use thumbnail control navigation in the <a href="http://nivo.dev7studios.com/">Nivo Slider</a>. If you need any more help then let me know in the comments.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=glopFl1tkeM:rIw7HoSiK_w:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=glopFl1tkeM:rIw7HoSiK_w:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=glopFl1tkeM:rIw7HoSiK_w:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=glopFl1tkeM:rIw7HoSiK_w:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=glopFl1tkeM:rIw7HoSiK_w:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=glopFl1tkeM:rIw7HoSiK_w:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=glopFl1tkeM:rIw7HoSiK_w:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=glopFl1tkeM:rIw7HoSiK_w:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/resource/using-thumbnails-with-the-nivo-slider/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
		<item>
		<title>Nivo Zoom</title>
		<link>http://dev7studios.com/portfolio/nivo-zoom/</link>
		<comments>http://dev7studios.com/portfolio/nivo-zoom/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 15:19:09 +0000</pubDate>
		<dc:creator>Gilbert</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=175</guid>
		<description><![CDATA[Nivo Zoom is a free jQuery Image Zoomer intended as a replacement to lightboxes.]]></description>
			<content:encoded><![CDATA[Nivo Zoom is a free jQuery Image Zoomer intended as a replacement to lightboxes.<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=d4zYrIlTHTA:6sQtve-t0nU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=d4zYrIlTHTA:6sQtve-t0nU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=d4zYrIlTHTA:6sQtve-t0nU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=d4zYrIlTHTA:6sQtve-t0nU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=d4zYrIlTHTA:6sQtve-t0nU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=d4zYrIlTHTA:6sQtve-t0nU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=d4zYrIlTHTA:6sQtve-t0nU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=d4zYrIlTHTA:6sQtve-t0nU:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/portfolio/nivo-zoom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Will It Work</title>
		<link>http://dev7studios.com/portfolio/will-it-work/</link>
		<comments>http://dev7studios.com/portfolio/will-it-work/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 18:46:51 +0000</pubDate>
		<dc:creator>Gilbert</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=172</guid>
		<description><![CDATA[Will it Work is a community of people who share their experiences so that others can benefit from their knowledge.]]></description>
			<content:encoded><![CDATA[Will it Work is a community of people who share their experiences so that others can benefit from their knowledge.<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=eBGWomUf97M:dQiT3CN1Kq8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=eBGWomUf97M:dQiT3CN1Kq8:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=eBGWomUf97M:dQiT3CN1Kq8:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=eBGWomUf97M:dQiT3CN1Kq8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=eBGWomUf97M:dQiT3CN1Kq8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=eBGWomUf97M:dQiT3CN1Kq8:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=eBGWomUf97M:dQiT3CN1Kq8:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=eBGWomUf97M:dQiT3CN1Kq8:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/portfolio/will-it-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Luxury Notes Theme</title>
		<link>http://dev7studios.com/portfolio/luxury-notes-wordpress-theme/</link>
		<comments>http://dev7studios.com/portfolio/luxury-notes-wordpress-theme/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 17:22:17 +0000</pubDate>
		<dc:creator>Gilbert</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=169</guid>
		<description><![CDATA[Luxury Notes is a free Wordpress &#038; Tumblr theme that is designed to act as a personal online notepad.]]></description>
			<content:encoded><![CDATA[Luxury Notes is a free Wordpress &#038; Tumblr theme that is designed to act as a personal online notepad.<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=bAxE4l6LKRk:lw5P1P0PB5Y:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=bAxE4l6LKRk:lw5P1P0PB5Y:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=bAxE4l6LKRk:lw5P1P0PB5Y:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=bAxE4l6LKRk:lw5P1P0PB5Y:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=bAxE4l6LKRk:lw5P1P0PB5Y:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=bAxE4l6LKRk:lw5P1P0PB5Y:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=bAxE4l6LKRk:lw5P1P0PB5Y:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=bAxE4l6LKRk:lw5P1P0PB5Y:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/portfolio/luxury-notes-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting Up the Nivo Slider in WordPress</title>
		<link>http://dev7studios.com/resource/setting-up-the-nivo-slider-in-wordpress/</link>
		<comments>http://dev7studios.com/resource/setting-up-the-nivo-slider-in-wordpress/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 11:08:32 +0000</pubDate>
		<dc:creator>Gilbert</dc:creator>
				<category><![CDATA[Resource]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=163</guid>
		<description><![CDATA[Setting up the Nivo Slider in WordPress is a fairly similar process to setting it up on a normal HTML page. However to do it properly there are a few small differences and methods you should use that are WordPress specific. Download and Setup First off download the Nivo Slider and put it in your [...]]]></description>
			<content:encoded><![CDATA[<p>Setting up the <a href="http://nivo.dev7studios.com/">Nivo Slider</a> in WordPress is a fairly similar process to setting it up on a normal HTML page. However to do it properly there are a few small differences and methods you should use that are WordPress specific.</p>
<h3>Download and Setup</h3>
<p>First off download the <a href="http://nivo.dev7studios.com/">Nivo Slider</a> and put it in your WordPress theme folder somewhere (for instance in &#8220;scripts/nivoslider&#8221;). You can put the CSS file in a separate folder if you wish but for simplicity I am just going to leave the contents of the download in the same folder. I&#8217;m also assuming here that you have your images in the &#8220;images&#8221; folder in your theme.</p>
<h3>The HTML</h3>
<p>Setting up the HTML for the slider is almost exactly the same as doing it in a normal HTML page. Something like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slider&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php bloginfo(&quot;</span>template_url<span style="color: #ff0000;">&quot;); ?&gt;</span></span>/images/slide_1.jpg&quot; alt=&quot;&quot; /&gt;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php bloginfo(&quot;</span>template_url<span style="color: #ff0000;">&quot;); ?&gt;</span></span>/images/slide_2.jpg&quot; alt=&quot;&quot; /&gt;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php bloginfo(&quot;</span>template_url<span style="color: #ff0000;">&quot;); ?&gt;</span></span>/images/slide_3.jpg&quot; alt=&quot;&quot; title=&quot;This is an example of a caption&quot; /&gt;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php bloginfo(&quot;</span>template_url<span style="color: #ff0000;">&quot;); ?&gt;</span></span>/images/slide_4.jpg&quot; alt=&quot;&quot; /&gt;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Note that images can have links and captions come from the images &#8220;title&#8221; attribute. We use the WordPress <a href="http://codex.wordpress.org/Function_Reference/bloginfo">bloginfo()</a> function to make sure we have the proper path to our images.</p>
<h3>The PHP &#038; Javascript</h3>
<p>On to the fun part. Here is the code first for you &#8220;copy &#038; pasters&#8221;.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Include jQuery --&gt;</span>
<span style="color: #009900;">&lt;?php wp_enqueue_script<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'jquery'</span><span style="color: #66cc66;">&#41;</span>; ?&gt;</span>
<span style="color: #009900;">&lt;?php wp_head<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; ?&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- Include the Nivo Slider CSS file --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php bloginfo(&quot;</span>template_url<span style="color: #ff0000;">&quot;); ?&gt;</span></span>/scripts/nivoslider/nivo-slider.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
<span style="color: #808080; font-style: italic;">&lt;!-- Include the Nivo Slider JS file --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php bloginfo(&quot;</span>template_url<span style="color: #ff0000;">&quot;); ?&gt;</span></span>/scripts/nivoslider/jquery.nivo.slider.pack.js&quot; type=&quot;text/javascript&quot;&gt;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- Set up the Nivo Slider --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
jQuery(window).load(function() {
	jQuery('#slider').nivoSlider();
});
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<p>First off we are going to <a href="http://digwp.com/2009/06/including-jquery-in-wordpress-the-right-way/">include jQuery the right way</a> by using the WordPress <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script">wp_enqueue_script()</a> function. Note that this has to be done before the wp_head() function.</p>
<p>Next we include the Nivo Slider CSS and JS files using the <a href="http://codex.wordpress.org/Function_Reference/bloginfo">bloginfo()</a> function to ensure the correct paths are used. Remember to alter the paths if the folder structure is different in your theme.</p>
<p>Finally we set up the jQuery script to load the Nivo Slider. Note that we need to use &#8220;jQuery&#8221; rather than just &#8220;$&#8221; as jQuery is in &#8220;no-conflict&#8221; mode. Now you should have a lovely slider on your WordPress site.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=QkVbLwBgKPI:T8PhZZMSVXU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=QkVbLwBgKPI:T8PhZZMSVXU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=QkVbLwBgKPI:T8PhZZMSVXU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=QkVbLwBgKPI:T8PhZZMSVXU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=QkVbLwBgKPI:T8PhZZMSVXU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=QkVbLwBgKPI:T8PhZZMSVXU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=QkVbLwBgKPI:T8PhZZMSVXU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=QkVbLwBgKPI:T8PhZZMSVXU:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/resource/setting-up-the-nivo-slider-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>70</slash:comments>
		</item>
		<item>
		<title>jQuery Nivo Slider</title>
		<link>http://dev7studios.com/portfolio/jquery-nivo-slider/</link>
		<comments>http://dev7studios.com/portfolio/jquery-nivo-slider/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 13:36:26 +0000</pubDate>
		<dc:creator>Gilbert</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=154</guid>
		<description><![CDATA[Nivo Slider is the Most Awesome jQuery Image Slider out. And it's free.]]></description>
			<content:encoded><![CDATA[Nivo Slider is the Most Awesome jQuery Image Slider out. And it's free.<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=y_QZCeTXPhw:Dco5EBp1pIw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=y_QZCeTXPhw:Dco5EBp1pIw:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=y_QZCeTXPhw:Dco5EBp1pIw:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=y_QZCeTXPhw:Dco5EBp1pIw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=y_QZCeTXPhw:Dco5EBp1pIw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=y_QZCeTXPhw:Dco5EBp1pIw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=y_QZCeTXPhw:Dco5EBp1pIw:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=y_QZCeTXPhw:Dco5EBp1pIw:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/portfolio/jquery-nivo-slider/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elegant &amp; Maintainable AJAX in Web Apps</title>
		<link>http://dev7studios.com/resource/elegant-maintainable-ajax-in-web-apps/</link>
		<comments>http://dev7studios.com/resource/elegant-maintainable-ajax-in-web-apps/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 22:58:54 +0000</pubDate>
		<dc:creator>Gilbert</dc:creator>
				<category><![CDATA[Resource]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=146</guid>
		<description><![CDATA[When creating modern web apps you can end up spending a lot of your time dealing with &#8220;AJAXifying&#8221; forms. Thanks to popularisation of Javascript frameworks this has become far simpler than it used to be. However as web developers we need to be looking at ways of streamlining the process and creating maintainable, elegant and [...]]]></description>
			<content:encoded><![CDATA[<p>When creating modern web apps you can end up spending a lot of your time dealing with &#8220;AJAXifying&#8221; forms. Thanks to popularisation of Javascript frameworks this has become far simpler than it used to be. However as web developers we need to be looking at ways of streamlining the process and creating maintainable, elegant and reusable code. This article will explain how to use <a href="http://jquery.com/">jQuery</a> and PHP to make using AJAX in your web apps a far simpler affair.</p>
<h3>HTML Forms</h3>
<p>One of the main problems with &#8220;AJAXifying&#8221; a form is that it doesn&#8217;t degrade nicely. If a user has Javascript turned off, all of a sudden your form&#8217;s are unusable. So what we ideally want to do is have perfectly normal working HTML forms that submit things to a PHP script, then drop some Javascript on top so that only users with Javascript turned on will get the benefit without punishing the minority. For those who are technically educated we want the Javascript to be completely decoupled from the HTML and PHP.</p>
<p>So when creating our HMTL forms we just create a bog standard working form:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;some_form&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;process.php&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;data&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;data&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Submit&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></pre></div></div>

<h3>The PHP</h3>
<p>The only downside to the process we are going to create here is that messaging has to be done in two different ways. This means the PHP has to account for both AJAX and non-AJAX requests and the different ways they pass data. Unfortunately at the moment there is no easy solution for this so we just have to work through it.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_X_REQUESTED_WITH'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_X_REQUESTED_WITH'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'xmlhttprequest'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//Do non AJAX processing here...</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//Do AJAX processing here...</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The one thing we do want to do if we are processing an AJAX request is make the data format we return as easy to use as possible. So I recommend using JSON. Not only does jQuery have built in parsing ability for JSON but PHP also makes it very easy to format and return a JSON response.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$response</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$response</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'error'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$response</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Do some processing. If there is an error...</span>
<span style="color: #000088;">$response</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'This is an Error returned by the server'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//... else ...</span>
<span style="color: #000088;">$response</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'data'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$data</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$response</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'error'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">json_encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$response</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Here we use a simple array with an &#8220;error&#8221; boolean value and a &#8220;message&#8221;. You can add any other data you want to the array (like the &#8220;data&#8221; we added above) and echo an output using PHP&#8217;s <a href="http://php.net/manual/en/function.json-encode.php">json_encode</a> function. It&#8217;s that simple. You&#8217;ll see why it&#8217;s worth doing this when we get into the Javascript below.</p>
<h3>The Javascript</h3>
<p>Remember what we are trying to do here is make the Javascript completely decoupled from the HTML and PHP. So what we are going to do is rig up all of the forms on the page to automatically be submitted using AJAX and fire off events for each form when something happens. This way we can simply hook into these form events to process what is happening.</p>
<p>Note that below we are using the <a href="http://jquery.malsup.com/form/">jQuery Form plugin</a> which provides us with the lovely ajaxSubmit function.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;form&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">submit</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	e.<span style="color: #660066;">preventDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> form <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	form.<span style="color: #660066;">ajaxSubmit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
		dataType<span style="color: #339933;">:</span> <span style="color: #3366CC;">'json'</span><span style="color: #339933;">,</span>
		beforeSubmit<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> event <span style="color: #339933;">=</span> jQuery.<span style="color: #660066;">Event</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:beforeSubmit'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			form.<span style="color: #660066;">trigger</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">isPropagationStopped</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
				<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		beforeSend<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			form.<span style="color: #660066;">trigger</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:beforeSend'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>json<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			form.<span style="color: #660066;">trigger</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:success'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span>json<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		error<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>response<span style="color: #339933;">,</span> <span style="color: #000066;">status</span><span style="color: #339933;">,</span> error<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			form.<span style="color: #660066;">trigger</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:error'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span>response<span style="color: #339933;">,</span> <span style="color: #000066;">status</span><span style="color: #339933;">,</span> error<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		complete<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			form.<span style="color: #660066;">trigger</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:complete'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>As you can see this small piece of Javascript rigs up all the forms on the page to be submitted using AJAX and trigger certain events during the process. The beforeSubmit event is a bit more complex as we want to be able to cancel the AJAX request in the event of form validation failing. So this is the Javascript we just drop into the page. Totally decoupled. </p>
<p>&#8220;But what do we do with it?&#8221; I hear you asking. Well it means that now all you have to do is hook in to those events for each form if you want to do some something with it. For example:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#some_form'</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:beforeSubmit'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">//Do your validation here...</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>validated<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			event.<span style="color: #660066;">stopPropagation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:beforeSend'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">//Show a loading message...</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:success'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #339933;">,</span> response<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>response.<span style="color: #660066;">error</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;strong&gt;Error:&lt;/strong&gt; '</span> <span style="color: #339933;">+</span> response.<span style="color: #660066;">message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">//Update UI...</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:error'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #339933;">,</span> response<span style="color: #339933;">,</span> <span style="color: #000066;">status</span><span style="color: #339933;">,</span> error<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;strong&gt;Error:&lt;/strong&gt; An error occurred while trying to save'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:complete'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">//Hide loading message...</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>How cool is that? As you can see this makes attaching and processing form submissions via AJAX far easier. You don&#8217;t even have to use all of the events, only use the ones you need.</p>
<p>Two things to note. We use the <em>event.stopPropagation()</em> function in the &#8220;:beforeSubmit&#8221; event if we need to cancel the request. Also in the &#8220;:success&#8221; event we can use response.error and response.message. This is because we formatted our response in JSON in the PHP above. Any data that you put the PHP <em>response</em> array can now be access in the Javascript using &#8220;response.{data}&#8221;.</p>
<h3>Conclusion</h3>
<p>I would encourage all serious web developers using AJAX in their web apps to consider using a streamlined approach like the one outlined here when &#8220;AJAXifying&#8221; their forms. Clean, maintainable, reusable and elegant.</p>
<p>Credit where credit is due, this article builds upon the <a href="http://orderedlist.com/our-writing/resources/development/jquery-evented-programming-primer/">jQuery Evented Programming Primer</a> article over at <a href="http://orderedlist.com/">orderedlist.com</a> and would not be here if it wasn&#8217;t for amazing guys like them helping us out by sharing their knowledge.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=RHDYGtwbBJA:Yx19qJCkDXU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=RHDYGtwbBJA:Yx19qJCkDXU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=RHDYGtwbBJA:Yx19qJCkDXU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=RHDYGtwbBJA:Yx19qJCkDXU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=RHDYGtwbBJA:Yx19qJCkDXU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=RHDYGtwbBJA:Yx19qJCkDXU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=RHDYGtwbBJA:Yx19qJCkDXU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=RHDYGtwbBJA:Yx19qJCkDXU:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/resource/elegant-maintainable-ajax-in-web-apps/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Roll Your Own Breadcrumbs in WordPress</title>
		<link>http://dev7studios.com/resource/roll-your-own-breadcrumbs-in-wordpress/</link>
		<comments>http://dev7studios.com/resource/roll-your-own-breadcrumbs-in-wordpress/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 21:31:07 +0000</pubDate>
		<dc:creator>Gilbert</dc:creator>
				<category><![CDATA[Resource]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=135</guid>
		<description><![CDATA[In this tutorial I am going to show you how to do proper, full breadcrumbs in WordPress including nested categories and nested pages. Breadcrumbs are a pretty standard design pattern and can be very useful in a lot of website situations. I’m aware there are already some good plugins for adding breadcrumbs in WordPress but [...]]]></description>
			<content:encoded><![CDATA[<p>In this tutorial I am going to show you how to do proper, full breadcrumbs in WordPress including nested categories and nested pages. Breadcrumbs are a pretty standard design pattern and can be very useful in a lot of website situations.</p>
<p>I’m aware there are already some <a href="http://yoast.com/wordpress/breadcrumbs/">good</a> <a href="http://wordpress.org/extend/plugins/breadcrumb-navxt/">plugins</a> for adding breadcrumbs in WordPress but I’m going to show you how to do it the good old fashioned way.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> get_breadcrumbs<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Start the UL</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;ul class=&quot;breadcrumbs&quot;&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// Add the Home link</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a href=&quot;'</span><span style="color: #339933;">.</span> get_settings<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'home'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">.</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/a&gt;&lt;/li&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> 
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$catTitle</span> <span style="color: #339933;">=</span> single_cat_title<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$cat</span> <span style="color: #339933;">=</span> get_cat_ID<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$catTitle</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;li&gt; &amp;raquo; &quot;</span><span style="color: #339933;">.</span> get_category_parents<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$cat</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot; &amp;raquo; &quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/li&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> is_archive<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>is_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> 
		<span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;li&gt; &amp;raquo; Archives&lt;/li&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> is_search<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;li&gt; &amp;raquo; Search Results&lt;/li&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> is_404<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> 
		<span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;li&gt; &amp;raquo; 404 Not Found&lt;/li&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> 
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$category</span> <span style="color: #339933;">=</span> get_the_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$category_id</span> <span style="color: #339933;">=</span> get_cat_ID<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$category</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_name</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt; &amp;raquo; '</span><span style="color: #339933;">.</span> get_category_parents<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$category_id</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot; &amp;raquo; &quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">echo</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/li&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> is_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> 
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_queried_object</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_parent</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;li&gt; &amp;raquo; &quot;</span><span style="color: #339933;">.</span>the_title<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/li&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$ancestors</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_reverse</span><span style="color: #009900;">&#40;</span> get_post_ancestors<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #990000;">array_push</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ancestors</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$ancestors</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$ancestor</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
					<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$ancestor</span> <span style="color: #339933;">!=</span> <span style="color: #990000;">end</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ancestors</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
						<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt; &amp;raquo; &lt;a href=&quot;'</span><span style="color: #339933;">.</span> get_permalink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ancestor</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">.</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span> apply_filters<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'single_post_title'</span><span style="color: #339933;">,</span> get_the_title<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$ancestor</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/a&gt;&lt;/li&gt;'</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
						<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt; &amp;raquo; '</span><span style="color: #339933;">.</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span> apply_filters<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'single_post_title'</span><span style="color: #339933;">,</span> get_the_title<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$ancestor</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// End the UL</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/ul&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>We then include the following code on any pages you want breadcrumbs to appear:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> get_breadcrumbs<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h3>The CSS Code</h3>
<p>The CSS code is just adding some simple styling so that the links appear inline. This can be styled as you wish.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">ul<span style="color: #6666ff;">.breadcrumbs</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
ul<span style="color: #6666ff;">.breadcrumbs</span> li <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">5px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<h3>The Explanation</h3>
<p>So what are we doing here? Well lets start at the start.</p>
<ul>
<li>First off don&#8217;t show breadcrumbs if it&#8217;s the homepage. If it&#8217;s not we add our first link which is to the top level homepage.</li>
<li>We then have a simple set of <code>elseif</code> statements which cover us for all the different situations we might find ourselves in. Some are fairly self explanatory like the seach, 404 and archive sections.</li>
<li>If it is a category we simply find the category ID then get list the parents of the current category. WordPress helps us with this by providing a &#8220;get_category_parents()&#8221; function.</li>
<li>If we are on a single page it gets a bit more in-depth. We have to find the category ID but in a slightly different way to above. However once you get the category ID it&#8217;s just the same method as above plus the addition of the title of the page you are on.</li>
</ul>
<p>Now pages are slightly more in depth but nothing too complex:</p>
<ul>
<li>First off get the page title. Easy.</li>
<li>We then find the ancestors of the page and reverse the order of them. Thankfully WordPress has a get_post_ancestors() function making our life much easier. The next line just adds the current post to the array of ancestors.</li>
<li>Finally we use a &#8220;foreach&#8221; loop to cycle through all of the ancestors and output them. The if statement in the loop makes sure that the last ancestor (the current page) doesn&#8217;t have a link.</li>
</ul>
<p>So there you have it. Fully customizable, valid breadcrumbs in WordPress.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=tXu33242M3I:oJAsm7n1fv8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=tXu33242M3I:oJAsm7n1fv8:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=tXu33242M3I:oJAsm7n1fv8:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=tXu33242M3I:oJAsm7n1fv8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=tXu33242M3I:oJAsm7n1fv8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=tXu33242M3I:oJAsm7n1fv8:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=tXu33242M3I:oJAsm7n1fv8:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=tXu33242M3I:oJAsm7n1fv8:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/resource/roll-your-own-breadcrumbs-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WP Theme Framework</title>
		<link>http://dev7studios.com/portfolio/wordpress-theme-framework/</link>
		<comments>http://dev7studios.com/portfolio/wordpress-theme-framework/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 14:07:19 +0000</pubDate>
		<dc:creator>Gilbert</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=28</guid>
		<description><![CDATA[The Wordpress Theme Framework (WTF) is a base framework for your Wordpress Themes.]]></description>
			<content:encoded><![CDATA[The Wordpress Theme Framework (WTF) is a base framework for your Wordpress Themes.<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=Gv_vIBNqY-k:coUdkWpj38Y:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=Gv_vIBNqY-k:coUdkWpj38Y:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=Gv_vIBNqY-k:coUdkWpj38Y:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=Gv_vIBNqY-k:coUdkWpj38Y:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=Gv_vIBNqY-k:coUdkWpj38Y:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=Gv_vIBNqY-k:coUdkWpj38Y:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=Gv_vIBNqY-k:coUdkWpj38Y:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=Gv_vIBNqY-k:coUdkWpj38Y:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/portfolio/wordpress-theme-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Luna WordPress Theme</title>
		<link>http://dev7studios.com/portfolio/luna-premium-wordpress-theme/</link>
		<comments>http://dev7studios.com/portfolio/luna-premium-wordpress-theme/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 14:04:35 +0000</pubDate>
		<dc:creator>Gilbert</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=25</guid>
		<description><![CDATA[Luna Theme is a professional blogging theme for Wordpress created for sale on ThemeForest.net. Get it for just $20.]]></description>
			<content:encoded><![CDATA[Luna Theme is a professional blogging theme for Wordpress created for sale on ThemeForest.net. Get it for just $20.<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=bodmZIdanpg:DLYLBRDJ8fQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=bodmZIdanpg:DLYLBRDJ8fQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=bodmZIdanpg:DLYLBRDJ8fQ:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=bodmZIdanpg:DLYLBRDJ8fQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=bodmZIdanpg:DLYLBRDJ8fQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=bodmZIdanpg:DLYLBRDJ8fQ:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=bodmZIdanpg:DLYLBRDJ8fQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=bodmZIdanpg:DLYLBRDJ8fQ:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/portfolio/luna-premium-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
