<?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>That PHP Girl &#187; custom template</title>
	<atom:link href="http://thatphpgirl.com/tag/custom-template/feed/" rel="self" type="application/rss+xml" />
	<link>http://thatphpgirl.com</link>
	<description>PHP, WordPress, and Theme Development</description>
	<lastBuildDate>Mon, 15 Mar 2010 13:57:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Attaching a Signature to Blog Content</title>
		<link>http://thatphpgirl.com/attaching-a-signature-to-blog-content/</link>
		<comments>http://thatphpgirl.com/attaching-a-signature-to-blog-content/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 17:22:30 +0000</pubDate>
		<dc:creator>Nikole</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[blog development]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[custom template]]></category>
		<category><![CDATA[feed]]></category>
		<category><![CDATA[internet marketing]]></category>
		<category><![CDATA[marketing]]></category>
		<category><![CDATA[social media]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://thatphpgirl.com/?p=485</guid>
		<description><![CDATA[Traditionally, blog posts have some sort of signature or about function built into the template that displays a snippet about the author somewhere in the post or sidebar. I recently reconsidered this functionality after reading the post Is Google Stealing Authors’ Copyright With Buzz?, because building a signature into the template works well for easily [...]]]></description>
			<content:encoded><![CDATA[<p>Traditionally, blog posts have some sort of signature or about function built into the template that displays a snippet about the author somewhere in the post or sidebar. I recently reconsidered this functionality after reading the post <a href="http://staynalive.com/articles/2010/02/25/is-google-stealing-authors-copyright-with-buzz/">Is Google Stealing Authors’ Copyright With Buzz?</a>, because building a signature into the template works well for easily changing the signature when needed or making default signatures for each author but it means the signature doesn&#8217;t go with the content. With the web becoming more mobile and being read less on the original site, it makes sense to make sure the purpose goes with content.</p>
<p>To that end, I&#8217;m going to try attaching a signature to all my posts here. I already tried it out with my <a href="http://oregontreehugger.com/building-the-strawberry-beds/" target="_new">latest post over at Oregon Treehugger</a>, and I am happy with the signature itself. As this content-based closing could live on in Google caches indefinitely, I think it&#8217;s important to put a lot of thought about it and figure out what to say. Some important points to remember:</p>
<ul>
<li><strong>Focus on what is most important.</strong> If you only have a few seconds to get across what is most important about you, make sure you are not rambling! Think of this in terms of your 7-second commercial &mdash; give us your unique selling proposition and get people interested in finding out more.</li>
<li><strong>Use three links or less.</strong> I went to a networking event last year and I was surprised at how many people were trying to tell people about many of their businesses/projects at the same time. If you want to lose your audience, link everything in your signature to all your various project. If you want to keep your focus, link one or two things so your readers have a clear direction to learn more.</li>
<li><strong>Tailor the closing to the content, or use them all for the same goal.</strong> If you are like other entrepreneurs, you probably have multiple pots on the stove right now. This leaves you with two choices &mdash; either tailor the closing to the content it is attached to, or use the closing of all your content to steer people toward the same end goal. For example, I write for a lot of sites but my main goal is always to increase business for myself here at That PHP Girl, and my current signature reflects that.</li>
<li><strong>Use simple formatting.</strong> As your CSS doesn&#8217;t always go with your content, use simple formatting for your signature, such as using italics and the small tag.</li>
<li><strong>Sell &mdash; or don&#8217;t.</strong> If you want your signature to be a commercial for your business, use it that way! Pitch a service like &quot;Learn how you can double your income in just 6 months &#8230;&quot; or &quot;Get your free consultation today at &#8230;&quot; If you would rather make it more of an about text, such as &quot;Judy is a marathon runner and elementary school PE teacher in Fitchburg, MA&#8230;&quot;, that is fine as well. There are no set rules for every business. Just be careful about putting anything temporary, such as a monthly special, as the content signature could outlive the advertised special by far.</li>
</ul>
<p><em>Nikole Gipps is a detail-oriented web developer, mud-loving Cornell Aggie, avid gardener, occasional iron chef, patient wife and fun mom of two. You can follow her work at <a href="http://thatphpgirl.com">That PHP Girl</a> or see all of her feeds at <a href="http://www.nikolegipps.com/">NikoleGipps.com</a>.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://thatphpgirl.com/attaching-a-signature-to-blog-content/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Navigating Your Dreams &#8230; LIVE!</title>
		<link>http://thatphpgirl.com/navigating-your-dreams-live/</link>
		<comments>http://thatphpgirl.com/navigating-your-dreams-live/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 02:18:40 +0000</pubDate>
		<dc:creator>Nikole</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[abstract]]></category>
		<category><![CDATA[blog development]]></category>
		<category><![CDATA[ciara daykin]]></category>
		<category><![CDATA[custom template]]></category>
		<category><![CDATA[daykin productions]]></category>
		<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[rockstar wedding planner]]></category>
		<category><![CDATA[shopping cart]]></category>
		<category><![CDATA[that php girl]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[theme customization]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[woo themes]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://thatphpgirl.com/?p=314</guid>
		<description><![CDATA[This fun and flirty version of the Woo Theme &#34;Abstract&#34; has gone through several versions since its launch &#8212; from brochure site to long-form sales page, it has retained its sense of style and marketing power.]]></description>
			<content:encoded><![CDATA[<p>In my latest installment for Rockstar Wedding Planner, Ciara Daykin &amp; crew needed a brochure site for their premiere wedding event for wedding planners, <a href="http://www.rockstarweddingplanner.com/live/" target="_new">Rockstar Wedding Planner LIVE!</a>. This site started out as the <a href="http://www.woothemes.com/2008/12/abstract/" target="_new">Abstract Theme by WooThemes</a>, to which I &#8230;</p>
<ul>
<li>Removed the decorative sidebar and shifted the content left.</li>
<li>Dropped the sidebar lower, modified it to randomly select testimonials, and added a logo to the top of the page on that side.</li>
<li>Created custom backgrounds for the page, header and footer.</li>
<li>Swapped out the footer widgets for a special announcement and a link list (using WordPress links).</li>
<li>Used a structure of pages instead of posts.</li>
<li>Connected to an existing shopping cart to create purchase options.</li>
<li>Changed color schemes and some font treatments to achieve the right look.</li>
<li>Created a graphic for the slogan to connect the elegance and star power of the event.</li>
<li>Formatted the content and pictures for flow.</li>
</ul>
<p>The end result is a flirty and fun site featuring the site owner&#8217;s favorite colors that does a great job in getting across the feel of the event itself. It is a big departure from the original format of the <a href="http://www.rockstarweddingplanner.com/live/" target="_new">Rockstar Wedding Planner LIVE!</a> site, which was more of a long sales form &mdash; and the folks at RSWP couldn&#8217;t be happier with their new design! The event (and the site) are sure to be another smashing success for Daykin Productions.</p>
]]></content:encoded>
			<wfw:commentRss>http://thatphpgirl.com/navigating-your-dreams-live/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Romance is in the Air</title>
		<link>http://thatphpgirl.com/romance-is-in-the-air/</link>
		<comments>http://thatphpgirl.com/romance-is-in-the-air/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 16:27:37 +0000</pubDate>
		<dc:creator>Nikole</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[blog development]]></category>
		<category><![CDATA[Callandra Caufield]]></category>
		<category><![CDATA[cherry tree occasions]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[custom template]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[post archives]]></category>
		<category><![CDATA[royalle]]></category>
		<category><![CDATA[social media]]></category>
		<category><![CDATA[that php girl]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[theme customization]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[woo themes]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://thatphpgirl.com/?p=309</guid>
		<description><![CDATA[For the Wedding Planner to the Wildly Romantic, I made a site that would showcase Callandra Caufield's services with beautiful imagery and unique touches.]]></description>
			<content:encoded><![CDATA[<p>Callandra Caufield, a wedding planner in the Canadian Rockies, had a dream in her head but no way to bring that to the web &#8230; until she teamed up with That PHP Girl, that is! I helped to to give life into the dream down to every last detail, from getting her color scheme just right to fine-tuning the user experience on her site. Her site started out as an install of <a href="http://www.woothemes.com/2009/10/royalle/" target="_new">Royalle by WooThemes</a>, and then was modified with:</p>
<ul>
<li>Custom backgrounds throughout.</li>
<li>Dropped navigation in the header, expanded wording in the footer.</li>
<li>Replacement header featuring Callandra&#8217;s fantastic logo.
<li>
<li>A new sidebar that changes from the blog to the static pages, and features a rotating testimonial and social media icons.</li>
<li>SEO helpers like the WPSEO plugin, sitemaps, and search engine pinging.</li>
<li>New blog formatting to suit Callandra&#8217;s needs.</li>
<li>Custom WordPress templates for blog archives, recent posts and testimonials.</li>
</ul>
<p>The end result is the launch of <a href="http://cherrytreeoccasions.com" target="_new">Cherry Tree Occasions &mdash; Wedding Planner to the Wildly Romantic</a>! I think all the small details on this site make it one of my favorites. Callandra and I really came together as a team to make this site great!</p>
]]></content:encoded>
			<wfw:commentRss>http://thatphpgirl.com/romance-is-in-the-air/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress for E-Commerce, Part 1</title>
		<link>http://thatphpgirl.com/wordpress-for-e-commerce-part-1/</link>
		<comments>http://thatphpgirl.com/wordpress-for-e-commerce-part-1/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 18:37:35 +0000</pubDate>
		<dc:creator>Nikole</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[categories]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[custom template]]></category>
		<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[online store]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[shopping cart]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress functions]]></category>

		<guid isPermaLink="false">http://thatphpgirl.com/?p=243</guid>
		<description><![CDATA[Today is part one of a three-part article on using Wordpress for E-Commerce. My goal is to create a sort of how-is-that-done series on using Wordpress as an easy content management tool for selling actual products. Some of these techniques can be implemented by anyone, whether you are an advanced programmer or a beginner to [...]]]></description>
			<content:encoded><![CDATA[<p>Today is part one of a three-part article on using Wordpress for E-Commerce. My goal is to create a sort of how-is-that-done series on using Wordpress as an easy content management tool for selling actual products. Some of these techniques can be implemented by anyone, whether you are an advanced programmer or a beginner to WordPress. Today&#8217;s example is from <a href="http://rockstarweddingplanner.com" target="_new">Rockstar Wedding Planner</a>, a recently relaunched site by <a href="http://www.thatphpgirl.com">That PHP Girl</a>.</p>
<h3>Why Use WordPress for E-Commerce?</h3>
<p>I have yet to find an e-commerce solution that I really like and that will do everything I need. Most of them are very complicated to do custom design on, or they are limited in terms of custom design in order to maintain functionality. The time-consuming nature of customizing e-commerce software is what makes an e-commerce site so expensive to make &#8230; and to be honest, most people don&#8217;t need a full-blown e-commerce solution because they won&#8217;t use most of the functionality, and/or they have very few products. Many people also don&#8217;t want a real store&mdash;they just want a way to throw in a few products into their content. So for those reasons, along with the ease of use and development of WordPress, finding a way to make WordPress work for e-commerce purposes makes sense.</p>
<h3>Anatomy of a Products Post</h3>
<p><a href="http://rockstarweddingplanner.com" target="_new">Rockstar Wedding Planner</a> has two main shopping areas: The products section and the coaching section.  <a href="http://rockstarweddingplanner.com/products/" target="_new">The products section</a> is just a category listing disguised as a page &mdash; it uses <a href="http://codex.wordpress.org/Function_Reference/WP_Query" target="_new">WP_Query</a> to pull all the posts from the products posting category and orders them by title. The loop then starts to display all the posts.</p>
<p>The first section is just a simple call to the <a href="http://codex.wordpress.org/Template_Tags/the_title" target="_new">the_title();</a> function in an h3 wrapper:</p>
<p><img src="http://thatphpgirl.com/wp-content/uploads/2009/09/post_anatomy1.png" alt="the_title();" /></p>
<p>The second section calls <a href="http://codex.wordpress.org/Template_Tags/the_content" target="_new">the_content();</a>, using the &lt;!&#8211;more&#8211;&gt; quicktag to control what is displayed on the page and what is displayed after the link.</p>
<p><img src="http://thatphpgirl.com/wp-content/uploads/2009/09/post_anatomy2.png" alt="the_content();" /></p>
<p>The third section calls a price for the product, and a description for that price if it is available (which it is when there is more than one price option). It starts out by finding out if a price is listed using a <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_new">custom field</a>, displaying the description if there is one, and then displaying the price.</p>
<p><img src="http://thatphpgirl.com/wp-content/uploads/2009/09/post_anatomy3.png" alt="the_content();" /></p>
<p>The code for that looks like this:</p>
<blockquote><p>&lt;?php if (post_custom(&#8216;bundle_price&#8217;) == true) { ?&gt;&lt;p&gt;&lt;?php if (post_custom(&#8216;bundle_price_descrip&#8217;) == true) { ?&gt;&lt;?php echo post_custom(&#8216;bundle_price_descrip&#8217;); ?&gt; | &lt;?php } ?&gt;Price: &lt;?php echo post_custom(&#8216;bundle_price&#8217;); ?&gt;&lt;/p&gt;&lt;?php } ?&gt;</p>
</blockquote>
<p>The fourth block is the actual add to cart button. Because the button and the surrounding code for the display stays the same for all products, I opted to just pull the link for this button from a custom field. The admin for the site simply pulls the store link for this product from their payment processor and adds it to the custom field.</p>
<p><img src="http://thatphpgirl.com/wp-content/uploads/2009/09/post_anatomy4.png" alt="Add to Cart Button" /></p>
<p>Code:</p>
<blockquote><p>&lt;?php if (post_custom(&#8216;bundle_link&#8217;) == true) { ?&gt;&lt;div class=&#8221;btn-buy&#8221;&gt;&lt;a href=&#8221;&lt;?php echo post_custom(&#8216;bundle_link&#8217;); ?&gt;&#8221;&gt;&lt;img src=&#8221;http://www.mcssl.com/netcart/images/cart_buttons/cart_button_12.gif&#8221; style=&#8221;border:none; background:none;&#8221; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;?php } ?&gt;</p>
</blockquote>
<p>The final block is a learn more link, which could possibly go to the rest of that post, or it could go to another page entirely.</p>
<p><img src="http://thatphpgirl.com/wp-content/uploads/2009/09/post_anatomy5.png" alt="Add to Cart Button" /></p>
<p>This is also accomplished through custom fields, using an if statement to determine if there is a special link, or if <a href="http://codex.wordpress.org/Template_Tags/the_permalink" target="_new">the_permalink();</a> should just be called:</p>
<blockquote><p>&lt;div class=&#8221;btn-continue&#8221;&gt;&lt;?php if (post_custom(&#8216;bundle_learnmore_link&#8217;) == true) { ?&gt;&lt;a href=&#8221;&lt;?php echo post_custom(&#8216;bundle_learnmore_link&#8217;); ?&gt;&#8221;&gt;&lt;?php echo post_custom(&#8216;bundle_learnmore_text&#8217;); ?&gt;&lt;?php } else { ?&gt;&lt;a href=&#8221;&lt;?php the_permalink(); ?&gt;&#8221;&gt;Learn More&lt;?php } ?&gt;&lt;/a&gt;&lt;/div&gt;</p>
</blockquote>
<p>The coaching section pretty much follows the same functionality, with the biggest exception being that no link is display if a learn more link is not entered as a custom field, instead of using the_permalink(); as the else alternative.</p>
<h3>Want a code-free version?</h3>
<p>WordPress is built upon the structure of categories, posts and pages. Most modern E-Commerce software is built with categories, products and extra content pages. So why can&#8217;t &quot;products&quot; just be posts in the category of &quot;products&quot;? If you want to simplify this whole thing, you could just purchase an existing theme (or use whatever you are using now), and create a category of products. Inside this category, you would use a new post for every one of your products including the description, price, and a Buy It Now button. (Buy It Now buttons can easily be created through services like <a href="http://www.google.com/checkout" target=_new">Google Checkout</a>, <a href="http://www.paypal.com" target=_new">PayPal</a> and <a href="http://www.1shoppingcart.com" target=_new">1ShoppingCart</a>.) Once you have all your products in, your &quot;store&quot; would then just be your category listing, for example /category/products/.</p>
<p>One note: Depending on your version of WordPress and how you edit your pages, it may not work to paste in button code for the visual editor. To solve this problem, enter your text into the visual editor, save the post, and then click on the HTML editor to put the button code in, clicking update post after you are done.</p>
<p>Hopefully I have given my readers some good ideas about what they can do with their own sites, but remember&mdash;if you get stuck, <a href="http://thatphpgirl.com/please-assist-me/">I&#8217;m always here to help!</a></p>
<p>Coming up: Part 2 will be on using WordPress with a custom, on-site cart solution. Part 3 will be about using a plugin to create a shopping solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://thatphpgirl.com/wordpress-for-e-commerce-part-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hear Florida &#8211; A Joomla to WordPress Conversion</title>
		<link>http://thatphpgirl.com/hear-florida-a-joomla-to-wordpress-conversion/</link>
		<comments>http://thatphpgirl.com/hear-florida-a-joomla-to-wordpress-conversion/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 23:37:32 +0000</pubDate>
		<dc:creator>Nikole</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[custom template]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[theme customization]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[user experience]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[word]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress functions]]></category>
		<category><![CDATA[yootheme]]></category>

		<guid isPermaLink="false">http://thatphpgirl.com/?p=199</guid>
		<description><![CDATA[Many clients end up with a website that is frustrating, difficult to use, or that doesn't meet their needs. Instead of scrapping the whole project, some sites can be quickly converted in other formats that better suit the company's needs, like this Joomla to WordPress conversion of Hear Florida which boosted the company's SEO capabilities.]]></description>
			<content:encoded><![CDATA[<p>Just being a developer who makes web sites is not enough&mdash;I have to think like a marketing/sales person and consider the long-term success potential of a site. I&#8217;m sure a lot of people like Joomla, and I&#8217;ve done some work on it for clients, but I&#8217;m not the biggest fan. There are just many things I find lacking, and among them are website marketing potential and client ease of use in terms of manipulating content. This is why I suggested converting <a href="http://www.hearflorida.com/">Hear Florida</a> from a Joomla site to a custom WordPress template when <a href="http://1stopmarketingsolutions.com">Michelle of 1Stop Marketing Solutions</a> came to me asking for help upgrading the site for better marketing and SEO.</p>
<p>To recreate Hear Florida in WordPress and upgrade it to the client&#8217;s needs, I pulled out the base HTML and CSS from what I believe was a modified <a href="http://www.yootheme.com">YooTheme</a> template, along with the content. I then &#8230;</p>
<ul>
<li>Configured the site to use permalinks.</li>
<li>Removed all layout-based tables from the content, and generally cleaned up the HTML and CSS for the site. (Tables displaying tabular data were retained.)</li>
<li>Installed and activated the <a href="http://www.wpseo.org">WPSEO</a> and <a href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/">Google Sitemaps</a> plugins.</a></li>
<li>Used the Google Maps API to create <a href="http://www.hearflorida.com/locations/boynton-beach/">location pages</a> which put the logo and address on a point on live maps. Each map point includes that location&#8217;s logo and contact information.</li>
<li>Added a <a href="http://www.hearflorida.com/topics/blog/">blog</a> with a feed and Feedburner connection. The blog features several custom archive page templates, including a <a href="http://www.hearflorida.com/topics/blog/hearing-loss-resources/">category listing</a>, a <a href="http://www.hearflorida.com/hearing-loss-safety-how-to-respond-to-emergency-signals-with-hearing-loss/">single page</a>, and an <a href="http://www.hearflorida.com/blog-archive/">all-posts listing</a>.</li>
<li>Added social media connections (Twitter, Facebook, AddThis) to the sidebar and the blog posts.</li>
<li>Created a newsletter signup form for use with a custom newsletter template.</li>
<li>Made a dynamic sidebar to load content as it is added by the content admin.</li>
<li>Created a <a href="http://www.hearflorida.com/topics/questions-answers/">Q &amp; A</a> section which includes a form to ask questions, a format for reading the answers to previous questions, and social media connections for sharing the content.</li>
<li>Organized the site and navigation for clarity, ease of use, and elimination of redundancy.</li>
</ul>
<p>Overall, all parties are pleased with the result and I am confident that this new version of the Hear Florida site will prove to have better longevity and marketability for the company.</p>
]]></content:encoded>
			<wfw:commentRss>http://thatphpgirl.com/hear-florida-a-joomla-to-wordpress-conversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Custom WordPress Blog Archives Page</title>
		<link>http://thatphpgirl.com/a-custom-wordpress-blog-archives-page/</link>
		<comments>http://thatphpgirl.com/a-custom-wordpress-blog-archives-page/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 15:05:43 +0000</pubDate>
		<dc:creator>Nikole</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[categories]]></category>
		<category><![CDATA[category achives]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[custom template]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[post archives]]></category>
		<category><![CDATA[user experience]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress functions]]></category>

		<guid isPermaLink="false">http://thatphpgirl.com/?p=155</guid>
		<description><![CDATA[Note: This post assumes you know how to use custom page templates in WordPress as well as know how to edit text php files and upload them through FTP. If you are already lost, you can always hire me to make your custom blog archive page for you.
I make a lot of sites that use [...]]]></description>
			<content:encoded><![CDATA[<p><em>Note: This post assumes you know how to use custom page templates in WordPress as well as know how to edit text php files and upload them through FTP. If you are already lost, you can always <a href="http://thatphpgirl.com/please-assist-me/">hire me to make your custom blog archive page</a> for you.</em></p>
<p>I make a lot of sites that use WordPress as a content management system (CMS) but not with the blog as the front page. For these, I use posts and categories to make various sections of the site using custom templates. My latest example of that is the Blog, Q&amp;A and Latest News sections of the site Hear Florida. For this, I wanted to make an archive page which lists all the categories, subcategories, and posts in what is technically the blog. I am sure someone is going to tell me that a plugin exists to do this thing, but as I tried two that didn&#8217;t work well, I had decided to give up and just use PHP. I also wanted to use as many standard WordPress calls as I could instead of just writing all my own functions.</p>
<p>In this exercise, this is what our final product will look like: <a href="http://www.hearflorida.com/blog-archive/">All Blog Posts Archive &raquo; Hear Florida Audiology Group</a>. It was created in a custom template called &quot;All Posts Archive&quot;. I will be breaking this down by parts and explaining what each part means to help my readers not only see the code, but to know what each part does. I will break this down piece by piece, but as a preview our final code will look like the chunk below.</p>
<blockquote><p>&lt;?php<br />
&nbsp;&nbsp;&nbsp;$all_cats = wp_list_categories(&#8216;hide_empty=0&#038;echo=0&#038;title_li=&#038;exclude=1&#8242;);<br />
&nbsp;&nbsp;&nbsp;$cats_list = explode(&quot;&lt;&quot;, $all_cats);<br />
&nbsp;&nbsp;&nbsp;$build_cat_structure = array();<br />
&nbsp;&nbsp;&nbsp;$array_counter = 0;<br />
&nbsp;&nbsp;&nbsp;foreach ($cats_list as $value) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$string_start = substr($value, 0, 3);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($string_start == &quot;li &quot; || $string_start == &quot;/a&gt;&quot; || $string_start == &quot;/li&quot;) { <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif ($string_start == &quot;ul &quot;) { <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$build_cat_structure[$array_counter] = &quot;start_child&quot;; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$array_counter = $array_counter + 1; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif ($string_start == &quot;/ul&quot;) { <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$build_cat_structure[$array_counter] = &quot;end_child&quot;; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$array_counter = $array_counter + 1; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif ($string_start == &quot;a h&quot;) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$cat_name = explode(&quot;&gt;&quot;, $value);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$build_cat_structure[$array_counter] = $cat_name[1];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$array_counter = $array_counter + 1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;echo &quot;&lt;ul&gt;&quot;;<br />
&nbsp;&nbsp;&nbsp;foreach ($build_cat_structure as $value) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($value == &quot;start_child&quot;) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;&lt;ul&gt;\n&quot;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif ($value == &quot;end_child&quot;) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;&lt;/ul&gt;\n&quot;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$category_id = get_cat_id($value);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &#8216;&lt;li&gt;&lt;a href=&quot;&#8217; . get_category_link($category_id) . &#8216;&quot;&gt;&#8217; . category_description($category_id) . &quot;&lt;/a&gt;&lt;/li&gt;\n&quot;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$children = wp_list_categories(&#8216;echo=0&#038;child_of=&#8217; . $category_id . &#8216;&#038;title_li=&#8217;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$find_me = stripos($children, &quot;No categories&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($find_me !== FALSE) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;&lt;ul&gt;\n&quot;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$the_query = new WP_Query(&#8216;cat=&#8217; . $category_id);&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while ($the_query-&gt;have_posts()) : $the_query-&gt;the_post(); $do_not_duplicate = $post-&gt;ID; ?&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a title=&quot;&lt;?php the_title(); ?&gt;&quot; href=&quot;&lt;?php the_permalink(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php endwhile;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;&lt;/ul&gt;\n&quot;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;echo &quot;&lt;/ul&gt;&quot;;<br />
?&gt;</p></blockquote>
<p>The first part pulls the categories and puts them into a list. If you wanted to shape the final outcome of the display, you could change the settings of wp_list_categories() here. For example, setting hide_empty=1 instead of 0, you could hide any categories that you have without posts. I have chosen to exclude the Uncategorized category (category #1), but if you wanted yours listed just removed the exclude=1 part. Or, if you would like to exclude other categories, just list them by number (exclude=1,5,6 for example). The echo=0 is important here because it puts the results into a variable instead of displaying them.</p>
<blockquote><p>&nbsp;&nbsp;&nbsp;$all_cats = wp_list_categories(&#8216;hide_empty=0&#038;echo=0&#038;title_li=&#038;exclude=1&#8242;);</p></blockquote>
<p>Once the result of <a href="http://codex.wordpress.org/Template_Tags/wp_list_categories">wp_list_categories</a> is dumped into the variable all_cats, it is broken apart into text chunks using the character &lt; as the divider.</p>
<blockquote><p>&nbsp;&nbsp;&nbsp;$cats_list = explode(&quot;&lt;&quot;, $all_cats);</p></blockquote>
<p>This basically puts every html chunk into it&#8217;s own entry in an array. (If at any point you want to see your results, feel free to do a var_dump($last_variable); and it will show you what you are working with.) I do this to set up the processing of the information in the next set of steps.</p>
<blockquote><p>&nbsp;&nbsp;&nbsp;$build_cat_structure = array();<br />
&nbsp;&nbsp;&nbsp;$array_counter = 0;</p></blockquote>
<p>This sets up an empty array which we will fill in the loop below, and starts our array key counter at 0.</p>
<blockquote><p>&nbsp;&nbsp;&nbsp;foreach ($cats_list as $value) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$string_start = substr($value, 0, 3);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($string_start == &quot;li &quot; || $string_start == &quot;/a&gt;&quot; || $string_start == &quot;/li&quot;) { <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif ($string_start == &quot;ul &quot;) { <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$build_cat_structure[$array_counter] = &quot;start_child&quot;; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$array_counter = $array_counter + 1; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif ($string_start == &quot;/ul&quot;) { <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$build_cat_structure[$array_counter] = &quot;end_child&quot;; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$array_counter = $array_counter + 1; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif ($string_start == &quot;a h&quot;) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$cat_name = explode(&quot;&gt;&quot;, $value);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$build_cat_structure[$array_counter] = $cat_name[1];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$array_counter = $array_counter + 1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;}</p></blockquote>
<p>This is where I have it to loop through the array I made by the earlier <a href="http://www.php.net/explode">explode()</a> command to set up the final array which will produce the display. By taking the first three letters of each array item as a seed, I can see where the html is going and reflect that in the final build. If the string starts with something that doesn&#8217;t influence the final outcome (the start of a list item, the end of a list item, and the end of a anchor tag), the command continue is issued to loop forward on to the next item. If hierarchy is detected (the start or end of an unordered list), a designation is added into the array and the counter advances. If the start of a link is detected (&quot;a h&quot; is the start of a href), it breaks apart that line using explode to pull out the name of the category. The category name is then added to the array and the counter is advanced.</p>
<p>These last parts are where I put it all together and display the data by looping through the array I built earlier ($build_cat_structure). You could probably do this differently or combine the above and below parts instead of looping through twice, but I liked it like this so I could use the data in other ways if I wanted to.</p>
<blockquote><p>&nbsp;&nbsp;&nbsp;echo &quot;&lt;ul&gt;&quot;;<br />
&nbsp;&nbsp;&nbsp;foreach ($build_cat_structure as $value) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($value == &quot;start_child&quot;) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;&lt;ul&gt;\n&quot;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif ($value == &quot;end_child&quot;) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;&lt;/ul&gt;\n&quot;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p></blockquote>
<p>This makes/ends a nested unordered list If it hits my start/end child marker, which makes the category hierarchy work. This is also a good chance to add specific styling to the inside nest lists, if that is what you want.</p>
<blockquote><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$category_id = get_cat_id($value);</p></blockquote>
<p>The start of the else tells the script what to do if it encounters the name of a category, or something that is not the start or end of a nested list. The next line converts our category name to a category ID using the <a href="http://codex.wordpress.org/Function_Reference/get_cat_ID">get_cat_id()</a> function.</p>
<blockquote><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &#8216;&lt;li&gt;&lt;a href=&quot;&#8217; . get_category_link($category_id) . &#8216;&quot;&gt;&#8217; . category_description($category_id) . &quot;&lt;/a&gt;&lt;/li&gt;\n&quot;;</p></blockquote>
<p>This displays the category in a list item with a link to the archive of that category using <a href="http://codex.wordpress.org/Function_Reference/get_category_link">get_category_link()</a>. I use <a href="http://codex.wordpress.org/Template_Tags/category_description">category_description()</a> here because my template is set up where the category name is a shorter version that is used for the sidebar and the category description is a longer version used for display. If you wanted to use the name instead, just replace category_description($category_id) with $value.</p>
<blockquote><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$children = wp_list_categories(&#8216;echo=0&#038;child_of=&#8217; . $category_id . &#8216;&#038;title_li=&#8217;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$find_me = stripos($children, &quot;No categories&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($find_me !== FALSE) {</p></blockquote>
<p>This special handling function checks to see if the current category is a parent of other categories. For example, on my final page (<a href="http://www.hearflorida.com/blog-archive/">All Blog Posts Archive &raquo; Hear Florida Audiology Group</a>), there is a main category of Blog for which I don&#8217;t want the posts listed. I want the posts listed under their sub categories, so it skips the post by post listing if the current category is a parent of other categories. A category that is not a parent of others will have something like &quot;&lt;li&gt;No Categories&lt;/li&gt;&quot; as the result of the above <a href="http://codex.wordpress.org/Template_Tags/wp_list_categories">wp_list_categories(child_of=)</a> call. The ($find_me !== FALSE) part creates a situation where the posts are only being displayed where the phrase &#8220;No Categories&#8221; is found.</p>
<blockquote><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;&lt;ul&gt;\n&quot;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$the_query = new WP_Query(&#8216;cat=&#8217; . $category_id);&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while ($the_query-&gt;have_posts()) : $the_query-&gt;the_post(); $do_not_duplicate = $post-&gt;ID; ?&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a title=&quot;&lt;?php the_title(); ?&gt;&quot; href=&quot;&lt;?php the_permalink(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php endwhile;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;&lt;/ul&gt;\n&quot;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;echo &quot;&lt;/ul&gt;&quot;;</p></blockquote>
<p>This last part creates another nesting with all of the posts for each category using <a href="http://codex.wordpress.org/Function_Reference/WP_Query">WP_Query</a>. The posts are displayed with their title and permalinks. Then everything is closed up and all the unordered lists are given end tags.</p>
<p>Overall I am pleased with my results and how it turned out in terms of giving the user a clear way to look through older posts by category and view all posts as a whole.</p>
]]></content:encoded>
			<wfw:commentRss>http://thatphpgirl.com/a-custom-wordpress-blog-archives-page/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
