<?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>Webstractions Web Development &#187; wordpress theme</title>
	<atom:link href="http://webstractions.com/tag/wordpress-theme/feed/" rel="self" type="application/rss+xml" />
	<link>http://webstractions.com</link>
	<description>Abstract thoughts in web design and development.</description>
	<lastBuildDate>Wed, 02 Mar 2011 12:22:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Writing a WordPress Function: breadcrumbs()</title>
		<link>http://webstractions.com/wordpress/writing-a-wordpress-function-breadcrumbs/</link>
		<comments>http://webstractions.com/wordpress/writing-a-wordpress-function-breadcrumbs/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 17:00:17 +0000</pubDate>
		<dc:creator>Ronnie T. Dodger</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[breadcrumbs]]></category>
		<category><![CDATA[function name prefix]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[helper functions]]></category>
		<category><![CDATA[html helpers]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[template functions]]></category>
		<category><![CDATA[template tags]]></category>
		<category><![CDATA[wordpress functions]]></category>
		<category><![CDATA[wordpress theme]]></category>

		<guid isPermaLink="false">http://webstractions.com/?p=84</guid>
		<description><![CDATA[Let's write a function for breadcrumbs that can be easily added to your Wordpress themes. Wordpress functions are preferable over the hundreds of plugins that are available -- to me anyway. ]]></description>
			<content:encoded><![CDATA[<p>A WordPress theme can optionally use a functions file, which resides in the theme subdirectory and is named <em>functions.php</em>. This file basically acts just like a WordPress plugin, and if it is present in the theme you are using, it is automatically loaded during WordPress initialization.</p>
<p>Since you can define a function that can be used in several template files of your theme, a useful function to have around would be breadcrumbs. Breadcrumbs are a user-friendly navigation tool to complement your blog with. They are also good for internal linking structure, which is a sound SEO practice. </p>
<h2>Organization First</h2>
<p>We can write new functions and place them inside functions.php without any problems. However, as we will be writing more functions in the future, this file will start to grow. The file will become bloated, unorganized, and harder to manage. </p>
<p>We will use functions.php to <em>include</em> another function file. This external  file will contain our breadcrumbs function, and other functions that are related to it. One related function for breadcrumbs will be a <em>helper</em> function that will generate the Html for anchor links (more on this later).</p>
<p>Also, instead of cluttering the main theme directory with all of our new function files, we will create a subdirectory to store them all in. This will have the added benefit of moving the entire directory into other theme designs without having to dig around looking for them in the main theme directory.</p>
<h2>Structuring Directories and Files</h2>
<p>Create a subdirectory inside of your main theme directory named <kbd>/functions/</kbd>. </p>
<p>Inside the new subdirectory, create a blank file named <kbd>template-functions.php</kbd>. We could have named this new file breadcrumbs.php, but I am planning on adding more template functions in the future. </p>
<p>Insert the following code into the newly created template-functions.php file and save it:</p>
<pre name="code" class="php">

&lt;?php

/***********************************************************
* wsf_breadcrumbs() - Shows breadcrumbs in template
***********************************************************/
function wsf_breadcrumbs() {
}

/***********************************************************
* Helper Functions for template coding
***********************************************************/
function wsf_make_link () {
}

 ?&gt;
</pre>
<p>Right now, the functions in this file do not do anything. Don&#8217;t worry, we will be fleshing that all out below.</p>
<p>Also note that I prefixed my function names with <kbd>wsf_</kbd>. All of my functions will be prefixed this way. The reason is to avoid any conflict with pre-existing functions or plugins.  </p>
<p>Hopefully this prefix is an unique one, and makes sense where it is coming from — in this case, wsf_ stands for <strong>W</strong>eb<strong>S</strong>tractions <strong>F</strong>unction. Feel free to use your own prefix in place of this one.</p>
<p>Open up the functions.php file inside your theme directory.  Most themes should have this file. If yours does not, create it. </p>
<p class="note">From this point on, I am assuming that you have a basic grasp of coding Wordperfect templates and some knowledge of how Php works. Remember that Php statements must reside between the <kbd>&lt;?php</kbd> and <kbd>?&gt;</kbd></p>
<p>Near the top of the functions.php file, and after the opening <kbd>&lt;?php</kbd> tag, add the following line of code:</p>
<pre name="code" class="php">

   require_once('functions/template-functions.php');
</pre>
<p>The canvas is now set, let&#8217;s get on with a little coding.<br />
<br clear="all" /></p>
<h2>Template Helper Functions</h2>
<p>Breadcrumbs contain at least one link, or they can contain many links. Each step in building the breadcrumbs involves repetitive Html coding for anchor links.</p>
<p>Lets create a helper function to dynamically create the Html for the anchor link and add in some optional goodies along with it. </p>
<p>Edit your <kbd>functions/template-functions.php</kbd> file for the wsf_make_link function:</p>
<pre name="code" class="php">

/***********************************************************
* Helper Functions for template coding
***********************************************************/
function wsf_make_link ( $url, $anchortext, $title=null, $nofollow=false ) {
   if ( $title == null ) $title=$anchortext;
   $nofollow==true ? $rel=' rel="nofollow"' : $rel = ''; 

   $link = sprintf( '<a href="%s" title="%s"%s>%s</a>', $url, $title, $rel, $anchortext );
   return $link;
}
</pre>
<p>This helper function takes two required parameters and two optional parameters. They are pretty much self-explanatory and you will notice that extra goody for setting the relationship of the link to Nofollow. </p>
<p>The helper function formats the parameters into a string variable and returns that variable for you to process further. Let&#8217;s put this function to work in our breadcrumbs function now.</p>
<h2>The breadcrumbs() Template Function</h2>
<p>Edit your <kbd>functions/template-functions.php</kbd> file for the wsf_breadcrumbs function:</p>
<pre name="code" class="php">

/***********************************************************
* wsf_breadcrumbs() - Shows breadcrumbs in template
***********************************************************/
function wsf_breadcrumbs( $sep = '/', $label = 'Browsing' ) {

	global $post;

   // Do not show breadcrumbs on home or front pages.
   // So we will just return quickly
   if((is_home() || is_front_page()) &#038;&#038; (!$front_page))
      return;

	// Create a constant for the separator, with space padding.
	$SEP = '&nbsp;' . $sep . '&nbsp;';

  echo '
<div class="breadcrumbs">';
	echo $label . ': ';
  echo wsf_make_link( get_bloginfo('url'), 'Home', get_bloginfo('name'), true ) . $SEP;

  if(is_single()) {
  	the_category(', '); echo $SEP;
	}
	elseif(is_page()) {
			$parent_id = $post->post_parent;
			$parents = array();
			while($parent_id) {
				$page = get_page($parent_id);
  			$parents[]  = wsf_make_link( get_permalink($page->ID), get_the_title($page->ID) ) . $SEP;
				$parent_id  = $page->post_parent;
			}
			$parents = array_reverse($parents);
			foreach($parents as $parent) {
				echo $parent;
			}
   }
   // Wordpess function that echoes your post title.
   the_title();
	 echo '</div>

';
}
</pre>
<p>The breadcrumbs function takes two optional parameters for the crumb separator and the label which gets pre-pended. Hopefully this is all pretty much explanatory.</p>
<p>Currently this function will only work on single post pages and pages that you create by hand. </p>
<p>For single posts, this function will look like the breadcrumb at the top of this page. If I have a post that contains more than one category, then they all will be listed and separated by a comma. (Ugly, I know. Will work on a better method in the future).</p>
<p>For your hand generated pages, there is a loop that will recursively step through the hierarchy of parent categories. You can have a page nested three, four, or more levels deep and this loop will follow it all the way back to the top. </p>
<p>In the future I plan on adding loops for tags, categories, archives, etc. But for now, the two biggies are here.</p>
<h2>Using Your breadcrumbs() Function in a Theme</h2>
<p>This is easy to plug into any theme. Since breadcrumbs will only show up for single posts and custom pages, you will only need to add the function to your <em>single.php</em> and <em>page.php</em> files.</p>
<p>Add this line in your theme file where you want the breadcrumbs to appear:</p>
<pre name="code" class="php">

   &lt;?php wsf_breadcrumbs('&raquo;','You are here') ?&gt;
</pre>
<p>That will generate a breadcrumb like this:</p>
<div class="breadcrumbs" style="font-size:.9em;background-color:#eee;">You are here: <a href="http://webstractions.com" title="Webstractions Web Development">Home</a>&nbsp;&raquo;&nbsp;<a href="http://webstractions.com/category/wordpress/" title="View all posts in WordPress" rel="category tag">WordPress</a>&nbsp;&raquo;&nbsp;Writing a WordPress Function: breadcrumbs()</div>
<p>&nbsp;</p>
<p>Kewl, eh? </p>
<p>That is about all there is to it. You just wrote some functions that you can re-use in all of your WordPress themes. Congratulations!</p>
<p>If you have any problems with this, let me know with a comment below. </p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://www.shareaholic.com/api/share/?title=Writing+a+Wordpress+Function%3A+breadcrumbs%28%29&amp;link=http://webstractions.com/wordpress/writing-a-wordpress-function-breadcrumbs/&amp;notes=Let%27s%20write%20a%20function%20for%20breadcrumbs%20that%20can%20be%20easily%20added%20to%20your%20Wordpress%20themes.%20Wordpress%20functions%20are%20preferable%20over%20the%20hundreds%20of%20plugins%20that%20are%20available%20--%20to%20me%20anyway.%20&amp;short_link=http://b2l.me/ap3wne&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://www.shareaholic.com/api/share/?title=Writing+a+Wordpress+Function%3A+breadcrumbs%28%29&amp;link=http://webstractions.com/wordpress/writing-a-wordpress-function-breadcrumbs/&amp;notes=Let%27s%20write%20a%20function%20for%20breadcrumbs%20that%20can%20be%20easily%20added%20to%20your%20Wordpress%20themes.%20Wordpress%20functions%20are%20preferable%20over%20the%20hundreds%20of%20plugins%20that%20are%20available%20--%20to%20me%20anyway.%20&amp;short_link=http://b2l.me/ap3wne&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=3&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.shareaholic.com/api/share/?title=Writing+a+Wordpress+Function%3A+breadcrumbs%28%29&amp;link=http://webstractions.com/wordpress/writing-a-wordpress-function-breadcrumbs/&amp;notes=Let%27s%20write%20a%20function%20for%20breadcrumbs%20that%20can%20be%20easily%20added%20to%20your%20Wordpress%20themes.%20Wordpress%20functions%20are%20preferable%20over%20the%20hundreds%20of%20plugins%20that%20are%20available%20--%20to%20me%20anyway.%20&amp;short_link=http://b2l.me/ap3wne&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-gmail">
			<a href="http://www.shareaholic.com/api/share/?title=Writing+a+Wordpress+Function%3A+breadcrumbs%28%29&amp;link=http://webstractions.com/wordpress/writing-a-wordpress-function-breadcrumbs/&amp;notes=Let%27s%20write%20a%20function%20for%20breadcrumbs%20that%20can%20be%20easily%20added%20to%20your%20Wordpress%20themes.%20Wordpress%20functions%20are%20preferable%20over%20the%20hundreds%20of%20plugins%20that%20are%20available%20--%20to%20me%20anyway.%20&amp;short_link=http://b2l.me/ap3wne&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=52&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this via Gmail">Email this via Gmail</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.shareaholic.com/api/share/?title=Writing+a+Wordpress+Function%3A+breadcrumbs%28%29&amp;link=http://webstractions.com/wordpress/writing-a-wordpress-function-breadcrumbs/&amp;notes=Let%27s%20write%20a%20function%20for%20breadcrumbs%20that%20can%20be%20easily%20added%20to%20your%20Wordpress%20themes.%20Wordpress%20functions%20are%20preferable%20over%20the%20hundreds%20of%20plugins%20that%20are%20available%20--%20to%20me%20anyway.%20&amp;short_link=http://b2l.me/ap3wne&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.shareaholic.com/api/share/?title=Writing+a+Wordpress+Function%3A+breadcrumbs%28%29&amp;link=http://webstractions.com/wordpress/writing-a-wordpress-function-breadcrumbs/&amp;notes=Let%27s%20write%20a%20function%20for%20breadcrumbs%20that%20can%20be%20easily%20added%20to%20your%20Wordpress%20themes.%20Wordpress%20functions%20are%20preferable%20over%20the%20hundreds%20of%20plugins%20that%20are%20available%20--%20to%20me%20anyway.%20&amp;short_link=http://b2l.me/ap3wne&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-twitter">
			<a href="http://www.shareaholic.com/api/share/?title=Writing+a+Wordpress+Function%3A+breadcrumbs%28%29&amp;link=http://webstractions.com/wordpress/writing-a-wordpress-function-breadcrumbs/&amp;notes=Let%27s%20write%20a%20function%20for%20breadcrumbs%20that%20can%20be%20easily%20added%20to%20your%20Wordpress%20themes.%20Wordpress%20functions%20are%20preferable%20over%20the%20hundreds%20of%20plugins%20that%20are%20available%20--%20to%20me%20anyway.%20&amp;short_link=http://b2l.me/ap3wne&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-printfriendly">
			<a href="http://www.shareaholic.com/api/share/?title=Writing+a+Wordpress+Function%3A+breadcrumbs%28%29&amp;link=http://webstractions.com/wordpress/writing-a-wordpress-function-breadcrumbs/&amp;notes=Let%27s%20write%20a%20function%20for%20breadcrumbs%20that%20can%20be%20easily%20added%20to%20your%20Wordpress%20themes.%20Wordpress%20functions%20are%20preferable%20over%20the%20hundreds%20of%20plugins%20that%20are%20available%20--%20to%20me%20anyway.%20&amp;short_link=http://b2l.me/ap3wne&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=236&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Send this page to Print Friendly">Send this page to Print Friendly</a>
		</li>
</ul><div style="clear: both;"></div><div class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://webstractions.com/wordpress/writing-a-wordpress-function-breadcrumbs/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Undocumented WordPress Query Function: wp_reset_query()</title>
		<link>http://webstractions.com/wordpress/undocumented-wordpress-query-function-wp_reset_query/</link>
		<comments>http://webstractions.com/wordpress/undocumented-wordpress-query-function-wp_reset_query/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 18:07:12 +0000</pubDate>
		<dc:creator>Ronnie T. Dodger</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[is_front_page()]]></category>
		<category><![CDATA[is_home]]></category>
		<category><![CDATA[query_posts()]]></category>
		<category><![CDATA[recent entries]]></category>
		<category><![CDATA[sidebar]]></category>
		<category><![CDATA[widgets]]></category>
		<category><![CDATA[wordpress functions]]></category>
		<category><![CDATA[wordpress theme]]></category>
		<category><![CDATA[wp_reset_query()]]></category>

		<guid isPermaLink="false">http://webstractions.com/?p=23</guid>
		<description><![CDATA[Creating a conditional sidebar widget in Wordpress turned into an odyssey of discovery. How an obscure usage of query_posts will bork your is_home() conditional tags.]]></description>
			<content:encoded><![CDATA[<p>Working with WordPress and coding themes is fairly easy to me. However, as is with every project, there comes a time in the process where you eventually pull your hair out. Such was the case when developing some simple<em> if logic</em> for the sidebar.</p>
<p>My goal was simple &mdash; suppress the Blogroll and Meta sections in the sidebar for any page except the Home Page. Logically, I thought, just surround the sections with the conditional tag is_home() should accomplish this simple feat. The WordPress Codex even has a <a href="http://codex.wordpress.org/Conditional_Tags#Variable_Sidebar_Content">dynamic sidebar example</a> for the use, pretty straight forward. </p>
<p>Take the following snippet of sidebar code for example. I am displaying a list of recent posts, immediately followed by the conditional blogroll.</p>
<pre name="code" class="html">
<ul class="sidebar_list">
<li class="widget">
<h3>Latest Blog Entries</h3>
<ul>
      &lt;?php query_posts('showposts=10'); ?&gt;
      &lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
<li>&lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title() ?&gt;&lt;/a&gt;</li>

      &lt;?php endwhile; endif; ?&gt;
      </ul>
</li>

   &lt;?php if(is_home() &#038;&#038; !is_paged()): ?&gt;
<li class="widget">
<h3>Blogroll</h3>
<ul>
      &lt;?php  wp_list_bookmarks('title_li=&#038;categorize=0'); ?&gt;
      </ul>
</li>

   &lt;?php endif; ?&gt;
</ul>
</pre>
<p>The above code returns true for <kbd>is_home()</kbd> on each and every non-home page or post. Why is that? This is where I lost quite a bit of hair, mostly from the left side of my head and therefore most of the insulation to the thinking part of the brain. Good thing the heat works around here.</p>
<p>It took quite a lot of searching. This is not an easy thing to Google for, but eventually came across some answers.</p>
<p>The culprit in the code was the use of <kbd>query_posts()</kbd> in the recent posts widget. If I swapped the positions of the two widgets, <kbd>is_home()</kbd> functioned correctly. The query_posts() function has an obscure little bug if you do not destroy it properly with a call to <kbd>wp_reset_query()</kbd>.</p>
<p>There isn&#8217;t any documentation on <kbd>wp_reset_query()</kbd> in the Codex, so I will cite the comment heading from the WordPress core file, query.php, which this function is from:</p>
<p><cite>wp_reset_query() destroys the previous query and setup a new query. This should be used after  query_posts() and before another query_posts(). This will remove obscure bugs that occur when the previous wp_query object is not destroyed properly before another is setup.</cite></p>
<p>So I added that function immediately following the endwhile in the recent comments widget, and bam, everything was right in the universe again.</p>
<pre name="code" class="html">
      ....
      &lt;?php query_posts('showposts=10'); ?&gt;
      &lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
         &lt;li&gt;&lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title() ?&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;?php endwhile; endif; ?&gt;
      &lt;?php wp_reset_query(); ?&gt;
      ....
</pre>
<p>Searching for references to <kbd>wp_reset_query()</kbd> in the WordPress core files reveals only one instance of usage. That instance, oddly enough, is in the widget.php function for displaying the recent entries widget. Imagine that!</p>
<p>Reviewing the code, however, I made another discovery. Instead of using <kbd>query_posts()</kbd>, they create a new <a href="http://codex.wordpress.org/Function_Reference/WP_Query">WP_query object</a> to cycle through the posts and generate the recent entry list items. They use the new object in order to preserve the original query in the <em>main</em> loop, <a href="http://codex.wordpress.org/The_Loop">the loop</a> that displays your posts on page.  More importantly, the new object preserves the values of is_home() and other conditional tags &mdash; the use of wp_reset_query is really not needed here. Seems to be a left over from a previous version and not edited out of the core code.</p>
<p>In order to do this the <em>wordpress-ian</em> way, I recoded my sidebar widget for recent posts (<em>sans wp_reset_query</em>):</p>
<pre name="code" class="html">
<li class="widget">
<h3>Latest Blog Entries</h3>
<ul>
      &lt;?php $r = new WP_Query(array('showposts' => '10', 'what_to_show' => 'posts',
	         'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1)); ?&gt;
      &lt;?php if ($r->have_posts()) : while ($r->have_posts()) : $r->the_post(); ?&gt;
<li>&lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title() ?&gt;&lt;/a&gt;</li>

      &lt;?php endwhile; endif; ?>
   </ul>
</li>
</pre>
<p>If you follow my logic in tracking down this little bugger, you will notice that my first resource to check was the conditional tag documentation in the Codex. Sadly, there is no mention of the consequences you will encounter by using query_posts() which alters the original page loop. </p>
<p>The WP support forum is filled with questions of &#8216;why is this not working&#8217;. Some go unanswered, some they fix and leave no reason how, some get the &#8216;review the conditonal tags documentation&#8217; buddy, and so on. It took a lot of searching to get a whiff of what I needed to do to correct the situation.</p>
<p>My suggestion is to at least insert a caveat into the documentation for conditional tags warning of what will happen to those tags if another query_posts() is called. This is the first place people will actually look for help after all. And it would probably save a lot of people&#8217;s time in the long run, not only the people seeking it, but the people offering a solution as well.</p>
<p><strong>UPDATE: </strong> The discussion for the creation of wp_reset_query() function can be found at <a href="http://trac.wordpress.org/ticket/4741">http://trac.wordpress.org/ticket/4741</a> if you are interested. Thanks to Stephen&#8217;s post <a href="http://striderweb.com/nerdaphernalia/2008/01/automated-indexes-and-wp_reset_query/">Automated Indexes and wp_reset_query()</a> at  Nerdaphernalia for pointing this out. </p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://www.shareaholic.com/api/share/?title=Undocumented+Wordpress+Query+Function%3A+wp_reset_query%28%29&amp;link=http://webstractions.com/wordpress/undocumented-wordpress-query-function-wp_reset_query/&amp;notes=Creating%20a%20conditional%20sidebar%20widget%20in%20Wordpress%20turned%20into%20an%20odyssey%20of%20discovery.%20How%20an%20obscure%20usage%20of%20query_posts%20will%20bork%20your%20is_home%28%29%20conditional%20tags.&amp;short_link=http://b2l.me/ap3ujv&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://www.shareaholic.com/api/share/?title=Undocumented+Wordpress+Query+Function%3A+wp_reset_query%28%29&amp;link=http://webstractions.com/wordpress/undocumented-wordpress-query-function-wp_reset_query/&amp;notes=Creating%20a%20conditional%20sidebar%20widget%20in%20Wordpress%20turned%20into%20an%20odyssey%20of%20discovery.%20How%20an%20obscure%20usage%20of%20query_posts%20will%20bork%20your%20is_home%28%29%20conditional%20tags.&amp;short_link=http://b2l.me/ap3ujv&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=3&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.shareaholic.com/api/share/?title=Undocumented+Wordpress+Query+Function%3A+wp_reset_query%28%29&amp;link=http://webstractions.com/wordpress/undocumented-wordpress-query-function-wp_reset_query/&amp;notes=Creating%20a%20conditional%20sidebar%20widget%20in%20Wordpress%20turned%20into%20an%20odyssey%20of%20discovery.%20How%20an%20obscure%20usage%20of%20query_posts%20will%20bork%20your%20is_home%28%29%20conditional%20tags.&amp;short_link=http://b2l.me/ap3ujv&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-gmail">
			<a href="http://www.shareaholic.com/api/share/?title=Undocumented+Wordpress+Query+Function%3A+wp_reset_query%28%29&amp;link=http://webstractions.com/wordpress/undocumented-wordpress-query-function-wp_reset_query/&amp;notes=Creating%20a%20conditional%20sidebar%20widget%20in%20Wordpress%20turned%20into%20an%20odyssey%20of%20discovery.%20How%20an%20obscure%20usage%20of%20query_posts%20will%20bork%20your%20is_home%28%29%20conditional%20tags.&amp;short_link=http://b2l.me/ap3ujv&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=52&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this via Gmail">Email this via Gmail</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.shareaholic.com/api/share/?title=Undocumented+Wordpress+Query+Function%3A+wp_reset_query%28%29&amp;link=http://webstractions.com/wordpress/undocumented-wordpress-query-function-wp_reset_query/&amp;notes=Creating%20a%20conditional%20sidebar%20widget%20in%20Wordpress%20turned%20into%20an%20odyssey%20of%20discovery.%20How%20an%20obscure%20usage%20of%20query_posts%20will%20bork%20your%20is_home%28%29%20conditional%20tags.&amp;short_link=http://b2l.me/ap3ujv&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.shareaholic.com/api/share/?title=Undocumented+Wordpress+Query+Function%3A+wp_reset_query%28%29&amp;link=http://webstractions.com/wordpress/undocumented-wordpress-query-function-wp_reset_query/&amp;notes=Creating%20a%20conditional%20sidebar%20widget%20in%20Wordpress%20turned%20into%20an%20odyssey%20of%20discovery.%20How%20an%20obscure%20usage%20of%20query_posts%20will%20bork%20your%20is_home%28%29%20conditional%20tags.&amp;short_link=http://b2l.me/ap3ujv&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-twitter">
			<a href="http://www.shareaholic.com/api/share/?title=Undocumented+Wordpress+Query+Function%3A+wp_reset_query%28%29&amp;link=http://webstractions.com/wordpress/undocumented-wordpress-query-function-wp_reset_query/&amp;notes=Creating%20a%20conditional%20sidebar%20widget%20in%20Wordpress%20turned%20into%20an%20odyssey%20of%20discovery.%20How%20an%20obscure%20usage%20of%20query_posts%20will%20bork%20your%20is_home%28%29%20conditional%20tags.&amp;short_link=http://b2l.me/ap3ujv&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-printfriendly">
			<a href="http://www.shareaholic.com/api/share/?title=Undocumented+Wordpress+Query+Function%3A+wp_reset_query%28%29&amp;link=http://webstractions.com/wordpress/undocumented-wordpress-query-function-wp_reset_query/&amp;notes=Creating%20a%20conditional%20sidebar%20widget%20in%20Wordpress%20turned%20into%20an%20odyssey%20of%20discovery.%20How%20an%20obscure%20usage%20of%20query_posts%20will%20bork%20your%20is_home%28%29%20conditional%20tags.&amp;short_link=http://b2l.me/ap3ujv&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=236&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Send this page to Print Friendly">Send this page to Print Friendly</a>
		</li>
</ul><div style="clear: both;"></div><div class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://webstractions.com/wordpress/undocumented-wordpress-query-function-wp_reset_query/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>The Building of a Blog</title>
		<link>http://webstractions.com/wordpress/the-building-of-a-blog/</link>
		<comments>http://webstractions.com/wordpress/the-building-of-a-blog/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 13:40:19 +0000</pubDate>
		<dc:creator>Ronnie T. Dodger</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[webstractive theme]]></category>
		<category><![CDATA[wordpress plugins]]></category>
		<category><![CDATA[wordpress settings]]></category>
		<category><![CDATA[wordpress theme]]></category>

		<guid isPermaLink="false">http://webstractions.com/?p=5</guid>
		<description><![CDATA[Travel with me through the inner workings of Wordpress during my installation and theme creation. What I did or did not do, and why. From Wordpress plugins to settings, it is all here.]]></description>
			<content:encoded><![CDATA[<p>While I am not totally new to WordPress as a blogging platform, this is the first time I have used it for my personal website. The previous version of this site, I had used Blogger which was FTP-ed to my server. With a few Php enhancements and a phpBB backend, I have managed to create a rather unique blogging atmosphere.</p>
<p>I am now starting from scratch with  WordPress 2.7 — this is the first time I have used this later version. The backend Admin area was totally rearranged. I rather like it though, especially the way Posts are laid out. It felt more comfortable to use to me.</p>
<p>What follows is an abstract for some of the high-points during the creation of this blog. More for documentation purposes, and in the future will be updated to include links to newer posts in which I can go into more detail.</p>
<h3>WordPress Settings</h3>
<p>Moved WordPress to the root domain per <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">Codex article</a>.</p>
<p>Turned off the Visual Editor in profile settings. </p>
<p>Custom structure for Permalinks <kbd>/%category%/%postname%/</kbd></p>
<h3>WordPress Plugins</h3>
<p>Akismet, of course.</p>
<p>That is about it. Pretty much lean and mean.</p>
<h3>WordPress Theme (Webstractive)</h3>
<p><div id="attachment_6" class="wp-caption alignright" style="width: 196px"><a href="http://webstractions.com/blog/wp-content/uploads/2009/02/01-13.jpg"><img src="http://webstractions.com/blog/wp-content/uploads/2009/02/01-13-186x300.jpg" alt="Early stages of theme development" title="01-13" width="186" height="300" class="size-medium wp-image-6" /></a><p class="wp-caption-text">Early stages of theme development</p></div>The new WordPress theme, dubbed <em>Webstractive</em>, is inspired by <a href="http://dmiracle.com/general/working-out-the-bugs/">Dawud Miracle&#8217;s new layout</a> that he launched in April of 2008. I liked the simple brown color schemes — it had an earthy quality to it.<br />
<br />
As a baseline, I am using the old <a href="http://www.pearsonified.com/theme/copyblogger/">Copyblogger theme</a>. Albeit, it is a heavily modified version that I use for new blogs and even a website that I developed with <a href="http://framework.zend.com">Zend Framework</a>. I got a lot of mileage out of this puppy!<br />
<br />
All graphics are created using Photoshop Elements, and an old version to boot. I am too set in my ways and this baby has served me well for a number of years. I am not too graphically talented, so why load up something that I never intend to use to its fullest.<br />
<br />
Use of <kbd>&lt;?php the_excerpt(); ?&gt;</kbd> on index, category and archive pages. This did not take too much thought. It is a little more work to create those little teasers, but I think it adds character and a touch of professionalism to a blog.</p>
<h3>Future Work</h3>
<p>Will update this post as needed, add in screenshots, document procedures, etc. yada, yada. As mentioned in my inaugural post, there is an undocumented &#8216;snafu&#8217; with the is_home() and is_front() functions in the WP core &#8211; more on that later too.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://www.shareaholic.com/api/share/?title=The+Building+of+a+Blog&amp;link=http://webstractions.com/wordpress/the-building-of-a-blog/&amp;notes=Travel%20with%20me%20through%20the%20inner%20workings%20of%20Wordpress%20during%20my%20installation%20and%20theme%20creation.%20What%20I%20did%20or%20did%20not%20do%2C%20and%20why.%20From%20Wordpress%20plugins%20to%20settings%2C%20it%20is%20all%20here.&amp;short_link=http://b2l.me/ap89c2&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://www.shareaholic.com/api/share/?title=The+Building+of+a+Blog&amp;link=http://webstractions.com/wordpress/the-building-of-a-blog/&amp;notes=Travel%20with%20me%20through%20the%20inner%20workings%20of%20Wordpress%20during%20my%20installation%20and%20theme%20creation.%20What%20I%20did%20or%20did%20not%20do%2C%20and%20why.%20From%20Wordpress%20plugins%20to%20settings%2C%20it%20is%20all%20here.&amp;short_link=http://b2l.me/ap89c2&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=3&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.shareaholic.com/api/share/?title=The+Building+of+a+Blog&amp;link=http://webstractions.com/wordpress/the-building-of-a-blog/&amp;notes=Travel%20with%20me%20through%20the%20inner%20workings%20of%20Wordpress%20during%20my%20installation%20and%20theme%20creation.%20What%20I%20did%20or%20did%20not%20do%2C%20and%20why.%20From%20Wordpress%20plugins%20to%20settings%2C%20it%20is%20all%20here.&amp;short_link=http://b2l.me/ap89c2&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-gmail">
			<a href="http://www.shareaholic.com/api/share/?title=The+Building+of+a+Blog&amp;link=http://webstractions.com/wordpress/the-building-of-a-blog/&amp;notes=Travel%20with%20me%20through%20the%20inner%20workings%20of%20Wordpress%20during%20my%20installation%20and%20theme%20creation.%20What%20I%20did%20or%20did%20not%20do%2C%20and%20why.%20From%20Wordpress%20plugins%20to%20settings%2C%20it%20is%20all%20here.&amp;short_link=http://b2l.me/ap89c2&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=52&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this via Gmail">Email this via Gmail</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.shareaholic.com/api/share/?title=The+Building+of+a+Blog&amp;link=http://webstractions.com/wordpress/the-building-of-a-blog/&amp;notes=Travel%20with%20me%20through%20the%20inner%20workings%20of%20Wordpress%20during%20my%20installation%20and%20theme%20creation.%20What%20I%20did%20or%20did%20not%20do%2C%20and%20why.%20From%20Wordpress%20plugins%20to%20settings%2C%20it%20is%20all%20here.&amp;short_link=http://b2l.me/ap89c2&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.shareaholic.com/api/share/?title=The+Building+of+a+Blog&amp;link=http://webstractions.com/wordpress/the-building-of-a-blog/&amp;notes=Travel%20with%20me%20through%20the%20inner%20workings%20of%20Wordpress%20during%20my%20installation%20and%20theme%20creation.%20What%20I%20did%20or%20did%20not%20do%2C%20and%20why.%20From%20Wordpress%20plugins%20to%20settings%2C%20it%20is%20all%20here.&amp;short_link=http://b2l.me/ap89c2&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-twitter">
			<a href="http://www.shareaholic.com/api/share/?title=The+Building+of+a+Blog&amp;link=http://webstractions.com/wordpress/the-building-of-a-blog/&amp;notes=Travel%20with%20me%20through%20the%20inner%20workings%20of%20Wordpress%20during%20my%20installation%20and%20theme%20creation.%20What%20I%20did%20or%20did%20not%20do%2C%20and%20why.%20From%20Wordpress%20plugins%20to%20settings%2C%20it%20is%20all%20here.&amp;short_link=http://b2l.me/ap89c2&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-printfriendly">
			<a href="http://www.shareaholic.com/api/share/?title=The+Building+of+a+Blog&amp;link=http://webstractions.com/wordpress/the-building-of-a-blog/&amp;notes=Travel%20with%20me%20through%20the%20inner%20workings%20of%20Wordpress%20during%20my%20installation%20and%20theme%20creation.%20What%20I%20did%20or%20did%20not%20do%2C%20and%20why.%20From%20Wordpress%20plugins%20to%20settings%2C%20it%20is%20all%20here.&amp;short_link=http://b2l.me/ap89c2&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=236&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Send this page to Print Friendly">Send this page to Print Friendly</a>
		</li>
</ul><div style="clear: both;"></div><div class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://webstractions.com/wordpress/the-building-of-a-blog/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

