<?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>Web Designer Notebook &#187; WordPress</title>
	<atom:link href="http://webdesignernotebook.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://webdesignernotebook.com</link>
	<description>Web Designer Notebook is a blog for web designers featuring topics like CSS, HTML and Wordpress, tutorials, reviews and inspiration.</description>
	<lastBuildDate>Mon, 06 Sep 2010 19:28:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>WordPress: Flexible Pages Lists With The Extended Page List Plugin</title>
		<link>http://webdesignernotebook.com/wordpress/wordpress-flexible-pages-lists-with-the-extended-page-list-plugin/</link>
		<comments>http://webdesignernotebook.com/wordpress/wordpress-flexible-pages-lists-with-the-extended-page-list-plugin/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 08:00:32 +0000</pubDate>
		<dc:creator>Inayaili León</dc:creator>
				<category><![CDATA[Project 52]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://webdesignernotebook.com/?p=1166</guid>
		<description><![CDATA[WordPress is quite versatile and easy to use, but it seems to fail in some features that should be present at its core, like the ability to list pages&#8217; content easier. Here&#8217;s an explanation of how to use a little plugin I found recently, and that doesn&#8217;t seem to be that widely known or documented. [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress is quite versatile and easy to use, but it seems to fail in some features that should be present at its core, like the ability to list pages&#8217; content easier. Here&#8217;s an explanation of how to use a little plugin I found recently, and that doesn&#8217;t seem to be that widely known or documented.</p>
<p><span id="more-1166"></span></p>
<h3>Me, the designer</h3>
<p>As I&#8217;ve said here before, eve though I&#8217;m not a complete beginner, my knowledge of WordPress is fairly limited. I&#8217;m essentially a front-end person, so the less I have to dive into PHP and the likes, the better. My goal is to always find a balance between flexible code and simplicity.</p>
<p>If, by the end of the post, you feel this could be easily done with another technique, feel free to leave a comment.</p>
<h3>My problem</h3>
<p>I needed to display the list of a certain page&#8217;s sub-pages, along with an excerpt from those pages. Very simple, right?</p>
<p>After some searches on Google and within the Codex, there didn&#8217;t seem to be a simple solution — that&#8217;s when <a href="http://twitter.com/andrewfox" rel="nofollow" >Andrew</a> pointed me to the <a href="http://wordpress.org/extend/plugins/extended-page-lists/" rel="nofollow" >Extended Page List plugin</a>.</p>
<h3>How to use the plugin</h3>
<p>First step: install the plugin.</p>
<p>The plugin uses a shortcode (<code>[epl]</code>) that you can add directly into your posts, and customise with some <a href="http://wordpress.grandslambert.com/plugins/extended-page-lists/shortcode-usage.html" rel="nofollow" >parameters</a>. It overrides the <a href="http://codex.wordpress.org/Function_Reference/get_pages" rel="nofollow" ><code>get_pages()</code></a> function, so you can use all of <code>get_pages()</code> parameters, plus a few more.</p>
<p>When editing a page, you would use something like this:</p>
<pre class="brush: xml;">[epl showexcerpt=1]</pre>
<p>But I needed to add the plugin to a template, to be used on a number of pages. The client was going to be able to edit the introductory text on each parent page, but the list of sub-pages should be generated automatically bellow that.</p>
<p>So I used the <a href="http://codex.wordpress.org/Function_Reference/do_shortcode" rel="nofollow" >do_shortcode function</a> on my template file. Its Codex page is not that useful.</p>
<p>This function allows you to call a shortcode and use it just as you would use it within a post (or page). So I could now do this:</p>
<pre class="brush: xml;">&lt;?php echo do_shortcode('[epl sort_column=menu_order showexcerpt=1 excerptlength=20 excerptmore=&quot;Read more&amp;hellip;&quot; morelink=1 excerpttag=&quot;&quot;]'); ?&gt;</pre>
<p>As you may notice, I used many of the parameters supported by the plugin to control what was displayed on the page. That&#8217;s one of the things I love about this plugin — the flexibility. You can control everything, from the excerpt&#8217;s length, to the HTML element that you want wrapping the whole block, or each page, which CSS class to apply, etc.</p>
<h3>Done!</h3>
<p>And that&#8217;s all! I decided to put this little post together, since I didn&#8217;t find any documentation on how to use this plugin within a template file — the plugin&#8217;s website itself doesn&#8217;t seem to mention it. And, although it may be clear to many people, it wasn&#8217;t for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://webdesignernotebook.com/wordpress/wordpress-flexible-pages-lists-with-the-extended-page-list-plugin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress: How To Display Multiple Values of a Custom Field Key</title>
		<link>http://webdesignernotebook.com/wordpress/wordpress-how-to-display-multiple-values-of-a-custom-field-key/</link>
		<comments>http://webdesignernotebook.com/wordpress/wordpress-how-to-display-multiple-values-of-a-custom-field-key/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 08:22:31 +0000</pubDate>
		<dc:creator>inayaili</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://webdesignernotebook.com/?p=99</guid>
		<description><![CDATA[In one of my recent adventures with WordPress I came across the need of having one or more custom fields values listed in one page. In my case, I wanted to list press quotes from theatre performances. This is quite simple and useful, so I decided to write a quick post that may be useful [...]]]></description>
			<content:encoded><![CDATA[<p>In one of my recent adventures with WordPress I came across the need of having one or more custom fields values listed in one page. In my case, I wanted to list press quotes from theatre performances.</p>
<p>This is quite simple and useful, so I decided to write a quick post that may be useful to someone else.</p>
<p><span id="more-99"></span></p>
<h3>Assumptions</h3>
<p>I&#8217;m assuming you&#8217;re familiar with WordPress, so I&#8217;ll just skip the part where I&#8217;m supposed to explain how great custom fields are and how they add so much value and power to WP. It&#8217;s all true, but this is a &#8220;quick post&#8221;.</p>
<h3>My requirements</h3>
<p>As I mentioned, I needed to list quotes from the press for a specific theatre perfomance. Some performances had no quotes at all, while others had several. I also didn&#8217;t want to see the &#8220;Press Quotes&#8221; title, unless there were quotes. So my short list of requirements was something like this:</p>
<ol>
<li>Check if there are any custom fields in the post.</li>
<li>If not, show nothing.</li>
<li>If there are, echo the list of values, but not inside <code>&lt;li&gt;</code> tags (which is the default behavior if you use <code>get_post_meta()</code>).  I want my values to be listed inside a <code>&lt;blockquote&gt;</code> and a <code>&lt;p&gt;</code>, to be semantically correct.</li>
</ol>
<h3>The code</h3>
<p>I&#8217;ll assume we&#8217;re working within <a href="http://codex.wordpress.org/The_Loop" rel="nofollow" >The Loop</a> here, so wherever you&#8217;re adding this code to, it should be contained within something that may look like this:</p>
<pre>
&lt;?php if(have_posts()) : while(have_posts()) : the_post(); ?&gt;

&lt;!-- This is just a comment, your code should come here --&gt;

&lt;?php endif; ?&gt;
</pre>
<p>Inside the Loop, add this bit of code:</p>
<pre>
&lt;?php
$press_quotes = get_post_meta($post-&gt;ID, "pressquote", false);
if ($press_quotes[0]=="") { ?&gt;

&lt;!-- If there are no custom fields, show nothing --&gt;

&lt;?php } else { ?&gt;

&lt;div class="pressQuotes"&gt;
	&lt;h3&gt;From the Press&lt;/h3&gt;

	&lt;?php foreach($press_quotes as $press_quotes) {
	echo '&lt;blockquote&gt;&lt;p&gt;'.$press_quotes.'&lt;/p&gt;&lt;/blockquote&gt;';
	} ?&gt;

&lt;/div&gt;

&lt;?php } ?&gt;
</pre>
<p>This is all you need to know:</p>
<ul>
<li><code>$press_quotes</code>: This is the variable that will store the value of each custom field. Replace by whatever suits you best (that&#8217;ll be 5 times in this code).</li>
<li><code>$press_quotes = get_post_meta($post-&gt;ID, "pressquote", false)</code>: <code>pressquote</code> is the actual Key of my custom field, as you can see in the image bellow:</li>
</ul>
<p><img src="http://webdesignernotebook.com/wp_livesite/wp-content/uploads/2009/03/custom-fields.jpg" alt="custom-fields" title="custom-fields" width="470" height="197" class="alignnone size-full wp-image-106" /></p>
<p>If there are no custom fields, the code will echo a handful of nothing (or my little comment).</p>
<p>If there are, I&#8217;m showing the <code>h3</code> tag with my pretty tittle, everything within a convenient <code>div</code>, for placement.</p>
<p>Then, I have to say what I want to repeat for each value (for each quote, in my case). So I write exactly that after the &#8220;echo&#8221; bit:</p>
<pre>
'&lt;blockquote&gt;&lt;p&gt;'.$press_quotes.'&lt;/p&gt;&lt;/blockquote&gt;'
</pre>
<p>Make sure to add the repeated HTML code within &#8216; &#8216; and the variable within . .</p>
<h3>It&#8217;s as simple as that!</h3>
<p>It may not be the only (nor the better) way of doing it, but it&#8217;s easy enough and it works. Let me know if you have any other methods!</p>
<h3>References</h3>
<ul>
<li><a href="http://perishablepress.com/press/2008/12/22/wordpress-custom-fields-tips-tricks/" rel="nofollow" >WordPress Custom Fields, Part II: Tips and Tricks</a></li>
<li><a href="http://codex.wordpress.org/Using_Custom_Fields" rel="nofollow" >WordPress Codex: Using Custom Fields</a></li>
<li><a href="http://codex.wordpress.org/Function_Reference/get_post_meta" rel="nofollow" >WordPress Codex: Function Reference/get post meta</a></li>
<li><a href="http://codex.wordpress.org/Function_Reference/get_post_custom" rel="nofollow" >WordPress Codex: Function Reference/get post custom</a></li>
<li><a href="http://codex.wordpress.org/Function_Reference/get_post_custom_keys" rel="nofollow" >WordPress Codex: Function Reference/get post custom keys</a></li>
<li><a href="http://codex.wordpress.org/Function_Reference/get_post_custom_values" rel="nofollow" >WordPress Codex: Function Reference/get post custom values</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://webdesignernotebook.com/wordpress/wordpress-how-to-display-multiple-values-of-a-custom-field-key/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
	</channel>
</rss>
