<?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>juliaholland.org &#187; WordPress</title>
	<atom:link href="http://www.juliaholland.org/category/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://www.juliaholland.org</link>
	<description></description>
	<lastBuildDate>Tue, 05 Jul 2011 21:03:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>Easy WordPress Breadcrumbs</title>
		<link>http://www.juliaholland.org/2010/05/24/easy-wordpress-breadcrumbs</link>
		<comments>http://www.juliaholland.org/2010/05/24/easy-wordpress-breadcrumbs#comments</comments>
		<pubDate>Mon, 24 May 2010 19:17:47 +0000</pubDate>
		<dc:creator>Julia</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.juliaholland.org/?p=231</guid>
		<description><![CDATA[Recently a client project required a breadcrumb navigation for all interior pages. After a bit of research and discovery of the useful WP function get_post_ancestors I created the following: Add to functions.php function my_breadcrumb&#40;&#41; &#123; &#160; if &#40;!is_home&#40;&#41;&#41; &#123; &#160; global $post; &#160; echo '&#60;a href=&#34;'; echo bloginfo&#40;'url'&#41;; echo '&#34;&#62;Home&#60;/a&#62; &#38;lt; '; &#160; if&#40;is_page&#40;&#41; &#38;&#38; [...]]]></description>
			<content:encoded><![CDATA[<p>Recently a client project required a breadcrumb navigation for all interior pages. After a bit of research and discovery of the useful WP function <a href="http://codex.wordpress.org/Function_Reference/get_post_ancestors">get_post_ancestors</a> I created the following:</p>
<p><strong>Add to functions.php</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> my_breadcrumb<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #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: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>	
&nbsp;
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&quot;&gt;Home&lt;/a&gt; &amp;lt; '</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>is_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_parent</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		        <span style="color: #000088;">$anc</span> <span style="color: #339933;">=</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: #339933;">;</span>
		        <span style="color: #000088;">$anc</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_reverse</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$anc</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;">$anc</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;">echo</span> <span style="color: #0000ff;">'&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: #b1b100;">echo</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: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' &amp;lt; '</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
                        <span style="color: #b1b100;">echo</span> the_title<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: #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: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_parent</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> the_title<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;">&#125;</span></pre></div></div>

<p><strong>Add to page template</strong></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> my_breadcrumb<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>

<p><strong>Creates the simple breadcrumb:</strong><br />
<a href="#">Home</a> &lt; Page I&#8217;m On </p>
<p>This was written for use only on WP Pages. If you want to use for your Posts, Tags (and others) you will need to include a case for is_single(), is_category(), is_tag(), etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.juliaholland.org/2010/05/24/easy-wordpress-breadcrumbs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with WordPress Themes</title>
		<link>http://www.juliaholland.org/2009/03/25/working-with-wordpress-themes</link>
		<comments>http://www.juliaholland.org/2009/03/25/working-with-wordpress-themes#comments</comments>
		<pubDate>Wed, 25 Mar 2009 17:10:43 +0000</pubDate>
		<dc:creator>Julia</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.juliaholland.org/?p=115</guid>
		<description><![CDATA[I spend a lot of time working with WordPress, using it for simple blogs and also as a CMS solution for client sites. Some of my most used code snippets and tricks I have listed below. Get your blog URL &#60;?php bloginfo&#40;'url'&#41;; ?&#62; Linking to an image/file (not from CSS file) In this case you [...]]]></description>
			<content:encoded><![CDATA[<p>I spend a lot of time working with WordPress, using it for simple blogs and also as a CMS solution for client sites. Some of my most used code snippets and tricks I have listed below.</p>
<h3 class="sub-header">Get your blog URL</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</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 class="sub-header">Linking to an image/file (not from CSS file)</h3>
<p>In this case you will need the URL to your theme files:</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> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>So for example, if your logo image is in your theme directory “/juliaholland/images” your code would then read</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;img src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/images/logo.gif&quot; /&gt;</pre></div></div>

<h3 class="sub-header">Find out if you are on the home page and set the ID for the div</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;body<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</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> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' id=&quot;home&quot;'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;</pre></div></div>

<h3 class="sub-header">Navigation &#8211; Manual</h3>
<p>Most sites that use WP as the CMS have navigation tabs/links that require an “active” state so that the user knows what page they are on.</p>
<p>An example of how this works:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;ul id=&quot;main-nav&quot;&gt;
   &lt;li id=&quot;blog&quot;&gt;&lt;a href=&quot;/&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_tag<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_year<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_month<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;">' class=&quot;active&quot;'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;Blog&lt;/a&gt;&lt;/li&gt;
   &lt;li id=&quot;about&quot;&gt;&lt;a href=&quot;/about/&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>is_page<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'About'</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;">' class=&quot;active&quot;'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;About&lt;/a&gt;&lt;/li&gt;
   &lt;li id=&quot;contact&quot;&gt;&lt;a href=&quot;/contact/&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>is_page<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Contact'</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;">' class=&quot;active&quot;'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;Contact&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre></div></div>

<h3 class="sub-header">Navigation &#8211; Automatic</h3>
<p>In this case, the navigation links will be automatically generated by your pages (top level).</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;ul id=&quot;main_nav&quot;&gt;
   &lt;li class=&quot;home<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_tag<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_year<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_month<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;">' current_page_item'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; title=&quot;Blog&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Blog'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/li&gt;
   <span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_list_pages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title_li=&amp;depth=1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>         	
&lt;/ul&gt;</pre></div></div>

<h3 class="sub-header">Multiple Sidebars</h3>
<p>This is particularly useful when you have several page templates and want to show different information in each of those sidebars.</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_sidebar<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: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Where sidebar-home.php is the name of your file.</p>
<h3 class="sub-header">Using Improved Include Page</h3>
<p><a href="http://wordpress.org/extend/plugins/improved-include-page/">This plugin</a> allows you to include different WP pages in one single page template. For example in your home template you might want to have different sections that can be edited from WP admin but aren’t all included in the same WP page.</p>
<p>Simply add</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> iinclude_page<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>to your home page template and the content from your page 4 will be included.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.juliaholland.org/2009/03/25/working-with-wordpress-themes/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Does a post have an excerpt specified?</title>
		<link>http://www.juliaholland.org/2008/07/28/does-a-post-have-an-excerpt-specifie</link>
		<comments>http://www.juliaholland.org/2008/07/28/does-a-post-have-an-excerpt-specifie#comments</comments>
		<pubDate>Mon, 28 Jul 2008 17:54:11 +0000</pubDate>
		<dc:creator>Julia</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.juliaholland.org/?p=59</guid>
		<description><![CDATA[Simple way to check if your WordPress post has an excerpt specified and either show the_excerpt or the_content. !empty&#40;$post-&#62;post_excerpt&#41; Example: &#60;?php if &#40;!empty&#40;$post-&#62;post_excerpt&#41;&#41; &#123; ?&#62; &#60;?php the_excerpt&#40;&#41;; ?&#62; &#60;?php &#125; else &#123; ?&#62; &#60;?php the_content&#40;'&#60;p&#62;Continue reading&#60;/p&#62;'&#41;; &#125; ?&#62;]]></description>
			<content:encoded><![CDATA[<p>Simple way to check if your WordPress post has an excerpt specified and either show the_excerpt or the_content.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_excerpt</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>Example:</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> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_excerpt</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_excerpt<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>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;p&gt;Continue reading&lt;/p&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.juliaholland.org/2008/07/28/does-a-post-have-an-excerpt-specifie/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

