<?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/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Pressing Pixels &#187; Code Snippets</title>
	<atom:link href="http://pressingpixels.com/category/code-snippets/feed/" rel="self" type="application/rss+xml" />
	<link>http://pressingpixels.com</link>
	<description>WordPress Resources &#38; More</description>
	<lastBuildDate>Mon, 02 Nov 2009 22:50:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9-rare</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Categorize Search Results in Wordpress</title>
		<link>http://pressingpixels.com/categorize-search-results-in-wordpress/</link>
		<comments>http://pressingpixels.com/categorize-search-results-in-wordpress/#comments</comments>
		<pubDate>Thu, 22 May 2008 17:41:01 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[categories]]></category>
		<category><![CDATA[conditional]]></category>
		<category><![CDATA[customize]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[results]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[tags]]></category>

		<guid isPermaLink="false">http://pressingpixels.com/categorize-search-results-in-wordpress/</guid>
		<description><![CDATA[I&#8217;ve always thought that search results pages could be done better.  It would be nice to present the data the user wants in a pleasing fashion.  In a blog situation or pretty much any situation where the majority of your content is categorized and or tagged, you can very easily present your user [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always thought that search results pages could be done better.  It would be nice to present the data the user wants in a pleasing fashion.  In a blog situation or pretty much any situation where the majority of your content is categorized and or tagged, you can very easily present your user a very organized search result based on specific categories and tags.</p>
<p>The theory behind this is simple really.  We&#8217;re just going to take some common WordPress logic and apply it to our scenario.</p>
<p>For example, if you were to happen to write a blog about developing with WordPress and most of your articles were focused on plugins and themes it would make sense that the majority of searches done on your site would be for content that related to those categories.  So why not present the user with the results from those categories specifically at the top of the search results?</p>
<p>Now, as far as I can tell you can&#8217;t just use conditional tags like you would in your sidebar or header like I referenced in my <a href="http://pressingpixels.com/custom-headers-for-different-pages-in-wordpress/">previous article on custom headers</a>.<br />
In those example you get to choose what content to query and display.  With search you don&#8217;t know what is specifically being queried, unless your name is <a href="http://en.wikipedia.org/wiki/Carnac_the_Magnificent">Carnac the Magnificent</a>&#8230;  </p>
<p>So the solution is to use multiple loops.  If you need to brush up on what the <a href="http://codex.wordpress.org/The_Loop">WordPress loop is you can read more here</a>.</p>
<p>Back to our blog scenario. Here is what we want to do. When somebody searches my site I want to present my users with any results from the plugin and theme categories first and then give them the rest of the search results.</p>
<p>So start off with your normal loop.</p>
<pre>
<code>&lt;?php if (have_posts()) : ?&gt; &lt;?php while (have_posts()) : the_post(); ?&gt;</code>
</pre>
<p>Next we&#8217;ll check to see if the user&#8217;s search query returned anything from our plugin category.  The number represents the plugin&#8217;s id.  You can find this out by going to manage>categories in your WP admin, either hover over the category name in the list and look at the bottom of your browser or click to edit a category and look at the end of the url in your address bar &#8211; that is the category id.</p>
<pre>
<code>&lt;?php if ( in_category('7') ): ?&gt;</code>
</pre>
<p>At this point you can put in whatever you want to display to the user whether its the title or the post, the excerpt, or the full content.  For simplicities sake I&#8217;m just going to display the title with a link to its permalink.</p>
<pre>
<code>&lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title() ?&gt;&lt;/a&gt;</code>
</pre>
<p>Now close out the if statement for your condition.</p>
<pre>
<code>&lt;?php endif; ?&gt;</code>
</pre>
<p>And close out the first loop.</p>
<pre>
<code>&lt;?php endwhile;  ?&gt;
&lt;?php endif; ?&gt; </code>
</pre>
<p>Now lets check to see if there are posts returned from the search in the themes category.</p>
<p>We are going to use another loop but in order to get the same set of results from the user&#8217;s search query we need to &#8220;rewind the posts.&#8221;  This function allows us to use the same query over again.  Here is the code.</p>
<pre>
<code>&lt;?php rewind_posts(); ?&gt;</code>
</pre>
<p>And now we just enter the same code for our loop with the conditional category.</p>
<pre>
<code>&lt;?php while (have_posts()) : the_post(); ?&gt;
    &lt;?php if ( in_category('17') ): ?&gt;
        &lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title() ?&gt;&lt;/a&gt;
    &lt;?php endif; ?&gt;
&lt;?php endwhile; ?&gt;</code>
</pre>
<p>If you have additional categories you would like to feature just repeat.</p>
<pre>
<code>&lt;?php rewind_posts(); ?&gt;

&lt;?php while (have_posts()) : the_post(); ?&gt;
    &lt;?php if ( in_category('17') ): ?&gt;
        &lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title() ?&gt;&lt;/a&gt;
    &lt;?php endif; ?&gt;
&lt;?php endwhile; ?&gt;</code>
</pre>
<p>Once you are done featuring categories of search results you will probably want to give the user the results that do not fit into your organized categories.  We&#8217;ll do this by once again rewinding our posts but don&#8217;t want to include the results we already have so we need to exclude the categories we featured.  The condition we are using checks to see if any posts are in a category and if they are they are skipped the query continues. Here is what the code looks like.</p>
<pre>
<code>&lt;?php rewind_posts(); ?&gt;

&lt;?php while (have_posts()) : the_post(); ?&gt;
   &lt;?php if (in_category('7')) continue; ?&gt;
   &lt;?php if (in_category('17')) continue; ?&gt;
        &lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title() ?&gt;&lt;/a&gt;
&lt;?php endwhile; ?&gt;</code>
</pre>
<p>Here is the entire thing.  I also put in some headings to seperate the content &#8211; though you don&#8217;t need to do that.</p>
<pre>
<code>&lt;h3&gt;Plugins&lt;/h3&gt;

    &lt;?php if (have_posts()) : ?&gt; &lt;?php while (have_posts()) : the_post(); ?&gt;
        &lt;?php if ( in_category('7') ): ?&gt;
            &lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title() ?&gt;&lt;/a&gt;
        &lt;?php endif; ?&gt;					

    &lt;?php endwhile;  ?&gt;
    &lt;?php endif; ?&gt;   

&lt;h3&gt;Themes&lt;/h3&gt;

    &lt;?php rewind_posts(); ?&gt;
        &lt;?php while (have_posts()) : the_post(); ?&gt;
            &lt;?php if ( in_category('17') ): ?&gt;
                &lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title() ?&gt;&lt;/a&gt;
            &lt;?php endif; ?&gt;
        &lt;?php endwhile; ?&gt;

&lt;h3&gt;Other Results&lt;/h3&gt;

    &lt;?php rewind_posts(); ?&gt;
        &lt;?php while (have_posts()) : the_post(); ?&gt;
            &lt;?php if (in_category('7')) continue; ?&gt;
            &lt;?php if (in_category('17')) continue; ?&gt;
                &lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title() ?&gt;&lt;/a&gt;
       &lt;?php endwhile; ?&gt;</code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://pressingpixels.com/categorize-search-results-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Custom Headers For Different Pages</title>
		<link>http://pressingpixels.com/custom-headers-for-different-pages-in-wordpress/</link>
		<comments>http://pressingpixels.com/custom-headers-for-different-pages-in-wordpress/#comments</comments>
		<pubDate>Thu, 01 May 2008 16:07:14 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[conditional tags]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[else]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[if]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://pressingpixels.com/custom-headers-for-different-pages-in-wordpress/</guid>
		<description><![CDATA[This entry is part 1 of 1 in the series WordPress Conditional Tags For DummiesThis article will begin a series of articles showing practical and real world examples on how to use conditional tags within WordPress.
So for starters let&#8217;s review what exactly a &#8220;conditional tag&#8221; is.  According to the WordPress Codex:
Conditional Tags can be [...]]]></description>
			<content:encoded><![CDATA[<div class="seriesmeta">This entry is part 1 of 1 in the series <a href="http://pressingpixels.com/series/wordpress-conditional-tags-for-dummies/" title="series-61">WordPress Conditional Tags For Dummies</a></div><p>This article will begin a series of articles showing practical and real world examples on how to use conditional tags within WordPress.</p>
<p>So for starters let&#8217;s review what exactly a &#8220;conditional tag&#8221; is.  According to the WordPress Codex:</p>
<blockquote><p>Conditional Tags can be used in your template files to change what content is displayed and how that content is displayed on a particular page depending on what conditions that page matches. For example, you might want to display a snippet of text above the series of posts, but only on the main page of your blog.</p></blockquote>
<p>So basically WordPress has built in a system of tags that checks your code for specific conditions.  If a condition come back as &#8220;true&#8221; one thing happens, if it comes back as &#8220;false&#8221; something else happens.</p>
<p>In today&#8217;s article we are going to work on a site to allow the home page to have a unique header from the rest of the pages.  You can see the article in action on the <a href="http://example.pressingpixels.com">Pressing Pixels demo site</a>.</p>
<p>The demo site we&#8217;ll be working with is using the theme &#8220;The Morning After&#8221; which is a brilliant free magazine style theme from Arun Kale.  <a href="http://themasterplan.in/themes/the-morning-after/">You can download it here.</a></p>
<p>In you look at the Morning After theme on Arun&#8217;s site you&#8217;ll notice that the theme has a standard sized header logo and image header for every page. I would like to have a larger and unique logo on my home page that is different than all the rest of the pages.</p>
<p>I won&#8217;t go into great detail but I had to do some work initially in the template styles and layout to make my images fit.  This will obviously be different for each theme you are working with and is not critical to fulfill the purpose of this article.</p>
<ul>
<li>I removed the &#8220;top banner&#8221; div from the home page and page templates</li>
<li>I moved the &#8220;page title template tag&#8221; into the body of the page template</li>
<li>I floated the right column right and the left column left.  I also had to move the right column div in front of the left in the home page template so that it would flow correctly</li>
</ul>
<p>With that done all that was left was to add in the conditions that would determine which logo went to which page.</p>
<p>Here is the code in its entirety (If you&#8217;re looking at the source code on the demo page you&#8217;ll notice I&#8217;ve removed a few of the custom style classes here to make the example cleaner).  We&#8217;ll break it down in second.</p>
<pre>
<code><span style="color:red">&lt;?php</span> <span style="color:green">if</span> (is_home() ) { <span style="color:red">?&gt;</span>

<span style="color:blue">&lt;div id="logo_home"&gt;</span>
     <span style="color:green">&lt;a href=</span>"<span style="color:red">&lt;?php</span> bloginfo(<span style="color:red">'url'</span>); <span style="color:red">?&gt;</span>"&gt;
      <span style="color:purple">&lt;img src=</span>"<span style="color:red">&lt;?php</span> bloginfo(<span style="color:red">'template_url'</span>); <span style="color:red">?&gt;</span><span style="color:blue">/images/logo.jpg"</span> <span style="color:purple">/&gt;</span><span style="color:green">&lt;/a&gt;</span>
<span style="color:blue">&lt;/div&gt;</span>

<span style="color:red">&lt;?php</span> } <span style="color:green">else<span> <span style="color:red">{ ?&gt;</span>

<span style="color:blue">&lt;div id="logo_other"&gt;</span>
     <span style="color:green">&lt;a href=</span>"<span style="color:red">&lt;?php</span> bloginfo(<span style="color:red">'url'</span>); <span style="color:red">?&gt;</span>"&gt;
      <span style="color:purple">&lt;img src=</span>"<span style="color:red">&lt;?php</span> bloginfo(<span style="color:red">'template_url'</span>); <span style="color:red">?&gt;</span><span style="color:blue">/images/logo2.png"</span> <span style="color:purple">/&gt;</span><span style="color:green">&lt;/a&gt;</span>
<span style="color:blue">&lt;/div&gt;</span>

<span style="color:red">&lt;?php</span> } <span style="color:red">?&gt;</span></code>
</pre>
<p>Okay, lets break it down.</p>
<p>In the header.php file I started out with the simple conditional tag &#8220;is_home&#8221;.  </p>
<pre><code class="php">&lt;?php if(is_home() ) { ?&gt;</code></pre>
<p>This particular tag checks to see if the page is the &#8220;home&#8221; page.  </p>
<p>The home page can be defined in a few different ways.  If you have a standard installation and have not changed any settings.  The home page is your blog address (URL) as defined in your WordPress general settings.  You can change this in the reading settings to set the &#8220;front&#8221; or &#8220;home page&#8221; to be something different.  </p>
<p>Whatever your particular case, the &#8220;is_home&#8221; tag refers to this page.</p>
<p>Notice that the tag includes &#8220;if&#8221;.  This is the piece that tells WordPress to look out, because it has some options to choose from.<br />
Also notice that the code ends with an opening brace.</p>
<pre><code> {</code></pre>
<p>The conditions fit inside of these braces.  Every condition you create (and you can create multiple which we&#8217;ll discuss in a later article) must be inside opening and closing braces.</p>
<p>So once we&#8217;ve checked to see if this is the home page we can enter the code for what we want to happen if that condition is true.  In this case, if our user is on the home page I want them to see a little larger logo.  So lets stick that in the code.</p>
<pre>
<code><span style="color:blue">&lt;div id="logo_home"&gt;</span>
     <span style="color:green">&lt;a href=</span>"<span style="color:red">&lt;?php</span> bloginfo(<span style="color:red">'url'</span>); <span style="color:red">?&gt;</span>"&gt;
      <span style="color:purple">&lt;img src=</span>"<span style="color:red">&lt;?php</span> bloginfo(<span style="color:red">'template_url'</span>); <span style="color:red">?&gt;</span><span style="color:blue">/images/logo.jpg"</span> <span style="color:purple">/&gt;</span><span style="color:green">&lt;/a&gt;</span>
<span style="color:blue">&lt;/div&gt;</span></code>
</pre>
<p>Now since we&#8217;ve checked to see if the condition is true (whether or not we&#8217;re on the home page) we need to define what happens if the condition is false.  We do that by using &#8220;else&#8221;.  Here is the code and notice the closing and opening of the braces.</p>
<pre>
<code><span style="color:red">&lt;?php</span> } <span style="color:green">else</span> { <span style="color:red">?&gt;</span></code>
</pre>
<p>The next step is to put in the code for what we want to happen if we are not on the home page.  And since we have not defined any additional conditions this next snippet of code will appear on every page that is not the home page.</p>
<pre>
<code><span style="color:blue">&lt;div id="logo_other"&gt;</span>
     <span style="color:green">&lt;a href=</span>"<span style="color:red">&lt;?php</span> bloginfo(<span style="color:red">'url'</span>); <span style="color:red">?&gt;</span>"&gt;
      <span style="color:purple">&lt;img src=</span>"<span style="color:red">&lt;?php</span> bloginfo(<span style="color:red">'template_url'</span>); <span style="color:red">?&gt;</span><span style="color:blue">/images/logo2.png"</span> <span style="color:purple">/&gt;</span><span style="color:green">&lt;/a&gt;</span>
<span style="color:blue">&lt;/div&gt;</span></code>
</pre>
<p>The only differences are the id of the container div and the name of the logo file.  I had to give them different div id&#8217;s because the heights of the respective logos were different and I wanted to define that in my style sheet.</p>
<p>The very last thing we need to do, and this is a step often forgotten is to close out our last condition with a closing curly brace.</p>
<pre>
<code><span style="color:red">&lt;?php</span> } <span style="color:red">?&gt;</span></code>
</pre>
<p>And that&#8217;s it.  This technique obviously does not just apply to header logos but with anything you would like to do uniquely on the home page.</p>
<p>The next article in the series will cover how to use multiple conditions.</p>
]]></content:encoded>
			<wfw:commentRss>http://pressingpixels.com/custom-headers-for-different-pages-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<series:name><![CDATA[WordPress Conditional Tags For Dummies]]></series:name>
	</item>
		<item>
		<title>How to Relate Pages in WordPress</title>
		<link>http://pressingpixels.com/how-to-relate-pages-in-wordpress/</link>
		<comments>http://pressingpixels.com/how-to-relate-pages-in-wordpress/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 16:46:32 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[pages]]></category>
		<category><![CDATA[post timages]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[relate pages]]></category>
		<category><![CDATA[tags]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[template tags]]></category>

		<guid isPermaLink="false">http://pressingpixels.com/how-to-relate-pages-in-wordpress/</guid>
		<description><![CDATA[A recent client project left me with perplexing problem.  I needed to be able to relate pages to one another.
My end goal was to have a product page that would display thumbnails of related accessories with links to those accessories.
The solution I choose was to use tags.  Tags?  I didn&#8217;t know you [...]]]></description>
			<content:encoded><![CDATA[<p>A recent client project left me with perplexing problem.  I needed to be able to relate pages to one another.</p>
<p>My end goal was to have a product page that would display thumbnails of related accessories with links to those accessories.</p>
<p>The solution I choose was to use tags.  Tags?  I didn&#8217;t know you could tag pages?  Well, out of the box you can&#8217;t, (not sure why) but there is a decent plugin called &#8220;<a href="http://www.michelem.org/wordpress-plugin-tags4page/">tags4pages</a>&#8221; that will add the tagging field to pages.</p>
<p>With that plugin installed all I have to do is go into an accessory page and in the tags section put the title of the product page the accessory should be related to.  The cool thing about using tags is that I can relate this accessory to as many products as I need to.  It is also very easy to disassociate an accessory &#8211; just delete the tag!</p>
<p>Now, I admit there are probably easier ways of doing this but it worked for me. Use the logic below at your own risk&#8230;</p>
<p>So now comes the fun part.  How in the world can I wrangle the code to display only the accessories with tag&#8217;s that match my main product&#8217;s title?</p>
<p>I&#8217;m working in the default &#8216;page&#8217; template in my WordPress theme but this would work for any page template.</p>
<p>Make sure you are not working in the current page&#8217;s loop.  Look for this code and start after it:</p>
<pre><code><span style="color:red">&lt;?php</span> <span style="color:green">endwhile</span>; <span style="color:green">endif</span>; <span style="color:red">?&gt;</span></code></pre>
<p>We need to get the title of the current page.</p>
<pre><code><span style="color:red">&lt;?php</span> $tag <span style="color:blue">=</span> get_the_title(); <span style="color:red">?&gt;</span></code></pre>
<p>Notice that you need to put &#8216;get_&#8217; before the WP title tag.  This allows you to put the page title in a variable &#8211; otherwise it would just print it on the page.</p>
<p>Next, we need to query our posts to come back with the appropriate pages (in our case all the pages that have the tag of our title).</p>
<pre>
<code><span style="color:red">&lt;?php</span> query_posts(<span style="color:red">"showposts=5&amp;tag=$tag"</span>); <span style="color:red">?&gt;</span></code>
</pre>
<p>This is the code written in English.<br />
&#8220;Please (its always good to be polite&#8230;) show me the five most recent posts or pages that have the tag I defined in my previous code snippet.&#8221;</p>
<p>That gets us our pages now we have to display them.  In my case I just want to display thumbnails with a link to the accessory page.  I&#8217;ve chosen an easy route to get the thumbnails and in this example they are not explicitly tied into the WP database (in other words, I&#8217;m cheating&#8230;).</p>
<p>I have a folder of images inside my main template folder where every image has the same name of its product page.</p>
<p>Let&#8217;s get our loop going.</p>
<pre>
<code><span style="color:red">&lt;?php</span> <span style="color:green">if</span> (have_posts()) <span style="color:blue">:</span> <span style="color:green">while</span> (have_posts()) <span style="color:blue">:</span> the_post(); <span style="color:red">?&gt;</span></code>
</pre>
<p>Now lets grab the image thumbnail and link it.</p>
<pre>
<code><span style="color:green">&lt;a href=</span><span style="color:blue">"</span><span style="color:red">&lt;?php</span> the_permalink() <span style="color:red">?&gt;</span>"&gt;
<span style="color:purple">&lt;img src=</span><span style="color:blue">"</span><span style="color:red">&lt;?php</span> bloginfo(<span style="color:red">'template_url'</span>); <span style="color:red">?</span>&gt;<span style="color:blue">/images/accessory_thumbs/</span>
<span style="color:red">&lt;?php</span> the_title() <span style="color:red">?&gt;</span><span style="color:blue">.jpg"</span> <span style="color:purple">alt=</span><span style="color:blue">"</span><span style="color:red">&lt;?php</span> the_title() <span style="color:red">?&gt;</span>"
<span style="color:purple">title=</span><span style="color:blue">"</span><span style="color:red">&lt;?php</span> $image_title = get_post_meta($post-&gt;ID, <span style="color:red">"image_title"</span>,
$single = <span style="color:green">true</span>); <span style="color:blue">echo</span> $image_title;<span style="color:red">?&gt;</span>" /&gt;<span style="color:green">&lt;/a&gt;</span></code>
</pre>
<p>Here is the code explanation:<br />
I&#8217;m grabbing the image from the &#8220;accessory_thumbs&#8221; folder which is in my current template folder (hence the &#8220;template_url&#8221;).  The actual file name is the same as the title of the page so I can use the WP template tag to get this.  I&#8217;m also using the title template tag as my alternate text.</p>
<p>The last thing I&#8217;m doing is putting a title on the image so that when someone rolls over the thumbnail a little context box pops up to let them know what this accessory is.  I&#8217;ve done this using a custom field.  On the accessory page I&#8217;ve created a custom field called &#8220;image_title&#8221; with a short product description.  The code you see above is getting the custom field &#8220;image_title&#8221; from the current post and displaying it.</p>
<p>End your loop and you are good to go!</p>
<p>Here is the full code snippet.</p>
<pre>
<code><span style="color:red">&lt;?php</span> $tag <span style="color:blue">=</span> get_the_title(); <span style="color:red">?&gt;</span>

<span style="color:red">&lt;?php</span> query_posts(<span style="color:red">"showposts=5&amp;tag=$tag"</span>); <span style="color:red">?&gt;</span>

<span style="color:red">&lt;?php</span> <span style="color:green">if</span> (have_posts()) <span style="color:blue">:</span> <span style="color:green">while</span> (have_posts()) <span style="color:blue">:</span> the_post(); <span style="color:red">?&gt;</span>

<span style="color:green">&lt;a href=</span><span style="color:blue">"</span><span style="color:red">&lt;?php</span> the_permalink() <span style="color:red">?&gt;</span>"&gt;
<span style="color:purple">&lt;img src=</span><span style="color:blue">"</span><span style="color:red">&lt;?php</span> bloginfo(<span style="color:red">'template_url'</span>); <span style="color:red">?</span>&gt;<span style="color:blue">/images/accessory_thumbs/</span>
<span style="color:red">&lt;?php</span> the_title() <span style="color:red">?&gt;</span><span style="color:blue">.jpg"</span> <span style="color:purple">alt=</span><span style="color:blue">"</span><span style="color:red">&lt;?php</span> the_title() <span style="color:red">?&gt;</span>"
<span style="color:purple">title=</span><span style="color:blue">"</span><span style="color:red">&lt;?php</span> $image_title = get_post_meta($post-&gt;ID, <span style="color:red">"image_title"</span>,
$single = <span style="color:green">true</span>); <span style="color:blue">echo</span> $image_title;<span style="color:red">?&gt;</span>" /&gt;<span style="color:green">&lt;/a&gt;</span>

<span style="color:red">&lt;?php</span> <span style="color:green">endwhile</span>; <span style="color:green">endif</span>; <span style="color:red">?&gt;</span></code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://pressingpixels.com/how-to-relate-pages-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
