<?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>rezzz &#187; php</title>
	<atom:link href="http://www.rezzz.com/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.rezzz.com</link>
	<description>a developers playground</description>
	<lastBuildDate>Fri, 06 Jan 2012 13:56:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Page of Posts in WordPress &#8211; Let the Slug Handle It</title>
		<link>http://www.rezzz.com/code/page-of-posts-in-wordpress-let-the-slug-handle-it</link>
		<comments>http://www.rezzz.com/code/page-of-posts-in-wordpress-let-the-slug-handle-it#comments</comments>
		<pubDate>Fri, 06 Jan 2012 13:56:04 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.rezzz.com/?p=399</guid>
		<description><![CDATA[Ever want to have a page of posts, but use custom fields, a specific template, or any other page attributes in WordPress. Well, I recently had a project where there was a need for great flexibility on each page and &#8230; <a href="http://www.rezzz.com/code/page-of-posts-in-wordpress-let-the-slug-handle-it">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Ever want to have a page of posts, but use custom fields, a specific template, or any other page attributes in WordPress.  Well, I recently had a project where there was a need for great flexibility on each page and post of the site to manipulate the right and left sidebars.  So I was using the custom fields so the client can put links, text, pics, videos along each side.  As with most WordPress implementations, I use the Reading Settings to tag a static page for the home page and blog page.  But in knowing how the blog page uses the index.php file to render the index of posts, I didn&#8217;t want that since the blog page had custom fields that needed to be rendered.</p>
<p>Since the blog page was only going to show a specific category of posts, I thought that I could &#8220;confuse&#8221; WordPress.  I made the category slug and the page slug exactly the same.  Important to note, the slug is not the title.  The slug is usually lowercase, no spaces, and WordPress usually generates it based off of the title, which you can obviously modify.</p>
<p>So I created a News page, and then a News category.  Then I created a news template within the theme as well.  I applied the news template to the News page under the Page Attributes section on the Edit screen.  The News page previewed just like any other page.  Then after some thought and scripting, I came up with the code below which allowed me to pull in the posts based on the slug.</p>
<div class="codecolorer-container php railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$tmp_post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span><br />
<span style="color: #666666; font-style: italic;">//Create a query for the category</span><br />
<span style="color: #000088;">$pageslug</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_name</span><span style="color: #339933;">;</span> <br />
<span style="color: #000088;">$paged</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>get_query_var<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'paged'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? get_query_var<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'paged'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'category_name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$pageslug</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'posts_per_page'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'paged'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$paged</span><br />
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
query_posts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
get_template_part<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'loop'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'index'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #666666; font-style: italic;">// bring control back</span><br />
<span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tmp_post</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Place the above code into the theme&#8217;s template file where you would like the list of posts to appear.  The part of this code that does the heavy lifting is that it reads the slug of the page and then builds the query to pull the posts of that category.  Obviously, that can spark some creative ideas with the page and post relationship.  I&#8217;d love to hear what other people have done for this type of situation and I hope that this helps others.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rezzz.com/code/page-of-posts-in-wordpress-let-the-slug-handle-it/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vmailGUI</title>
		<link>http://www.rezzz.com/portfolio/qmail</link>
		<comments>http://www.rezzz.com/portfolio/qmail#comments</comments>
		<pubDate>Mon, 21 Sep 2009 17:30:08 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[qmail]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[vmail]]></category>

		<guid isPermaLink="false">http://rezzz.dev/?p=1</guid>
		<description><![CDATA[This was a project I took on because my company started to use qmail for managing of email addresses.  So instead of having to write SQL into the tables, I created this simple, yet extremely useful, application to place on &#8230; <a href="http://www.rezzz.com/portfolio/qmail">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-26 aligncenter" title="vmailGUI" src="http://rezzz.dev/wp-content/uploads/2009/09/Screen-shot-2009-09-21-at-12.31.02-PM.png" alt="vmailGUI for qmail" /></p>
<p>This was a project I took on because my company started to use qmail for managing of email addresses.  So instead of having to write SQL into the tables, I created this simple, yet extremely useful, application to place on top, so anyone can administer the company email addresses</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rezzz.com/portfolio/qmail/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Team Cobra Kai</title>
		<link>http://www.rezzz.com/portfolio/teamcobra-kai</link>
		<comments>http://www.rezzz.com/portfolio/teamcobra-kai#comments</comments>
		<pubDate>Mon, 21 Sep 2009 16:46:03 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://rezzz.dev/?p=30</guid>
		<description><![CDATA[This is a website I designed to have some fun with my softball team.  There&#8217;s integration with an iPhone app called iScore.  That&#8217;s what we use to keep the book of the game.  It&#8217;ll aggregate all the guys&#8217; stats so &#8230; <a href="http://www.rezzz.com/portfolio/teamcobra-kai">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;"><a href="http://www.teamcobrakai.com"><img class="aligncenter size-full wp-image-52" title="Team Cobra Kai" src="http://rezzz.dev/wp-content/uploads/2009/09/Screen-shot-2009-09-21-at-2.08.09-PM.png" alt="Team Cobra Kai" width="590" height="200" /></a>This is a website I designed to have some fun with my softball team.  There&#8217;s integration with an iPhone app called iScore.  That&#8217;s what we use to keep the book of the game.  It&#8217;ll aggregate all the guys&#8217; stats so the guys can see their stats.  This site will be ever changing as I&#8217;m sort of using it for my playground.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rezzz.com/portfolio/teamcobra-kai/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

