<?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>WP Garage &#187; Code Snippets</title>
	<atom:link href="http://wpgarage.com/category/code-snippets/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpgarage.com</link>
	<description>wordpress tricks, hacks, and tips</description>
	<lastBuildDate>Tue, 15 May 2012 11:49:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>How to fix apostrophes turning into slashes in WordPress</title>
		<link>http://wpgarage.com/code-snippets/how-to-fix-apostrophes-turning-into-slashes-in-wordpress/</link>
		<comments>http://wpgarage.com/code-snippets/how-to-fix-apostrophes-turning-into-slashes-in-wordpress/#comments</comments>
		<pubDate>Sun, 15 Apr 2012 13:58:52 +0000</pubDate>
		<dc:creator>Rebecca Markowitz</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[apostrophe]]></category>
		<category><![CDATA[backslash]]></category>
		<category><![CDATA[custom options]]></category>
		<category><![CDATA[slash]]></category>
		<category><![CDATA[strip]]></category>

		<guid isPermaLink="false">http://wpgarage.com/?p=1266</guid>
		<description><![CDATA[<p>We build our sites with a custom theme options panel in the Dashboard so that clients can manage as much of their site on their own as possible. All seemed fine and dandy until the client threw in an apostrophe! The chutzpah. Can&#8217;t you just use &#8220;We will&#8221; instead of &#8220;We&#8217;ll&#8221;? The problem was that [...]</p><p>This post was originally published at <a href="http://wpgarage.com/code-snippets/how-to-fix-apostrophes-turning-into-slashes-in-wordpress/">How to fix apostrophes turning into slashes in WordPress</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://wpgarage.com/code-snippets/how-to-fix-apostrophes-turning-into-slashes-in-wordpress/" data-url="http://illum.in/Ip546J" data-text="How to fix apostrophes turning into slashes in WordPress" data-count="vertical" data-via="wpgarage" data-related="wpgarage"><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://wpgarage.com/code-snippets/how-to-fix-apostrophes-turning-into-slashes-in-wordpress/&amp;layout=box_count&amp;show_faces=true&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://wpgarage.com/code-snippets/how-to-fix-apostrophes-turning-into-slashes-in-wordpress/"></g:plusone></div></div><p>We build our sites with a custom theme options panel in the Dashboard so that clients can manage as much of their site on their own as possible. All seemed fine and dandy until the client threw in an apostrophe! The chutzpah. Can&#8217;t you just use &#8220;We will&#8221; instead of &#8220;We&#8217;ll&#8221;?</p>
<p>The problem was that when an apostrophe was entered into a custom text label in the options panel, a slash decided to come along for the ride. Example: Instead of seeing &#8220;We&#8217;ll send you a link&#8221;, the site displayed &#8220;We\&#8217;ll send you a link&#8221;. I searched around and finally found this post, <a href="http://curtismchale.ca/2010/12/09/using-stripslashes-with-theme-options/">Using stripslashes() with Theme Options</a> which explains that you need to use the stripslashes function when you return the content stored in the custom text.</p>
<p>Basically, you just wrap stripslashes() around the get_option like so:</p>
<p>If you had &lt;?php  echo get_option(&#8216;cgn_<wbr>404_text&#8217;); ?&gt;</wbr></p>
<p>it would now be:</p>
<p>&lt;?php  echo stripslashes(get_option(&#8216;cgn_<wbr>404_text&#8217;)); ?&gt;</wbr></p>
<p>In your custom-text.php file, you&#8217;ll probably use something like this:</p>
<div>&lt;?php echo  stripslashes($selected_book_<wbr>description); ?&gt;</wbr></div>
<div> </div>
<div>No more slashtastrophies!</div>
<div> </div>
<p>This post was originally published at <a href="http://wpgarage.com/code-snippets/how-to-fix-apostrophes-turning-into-slashes-in-wordpress/">How to fix apostrophes turning into slashes in WordPress</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://wpgarage.com/code-snippets/how-to-fix-apostrophes-turning-into-slashes-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How to list subpages with a title and excerpt in WordPress</title>
		<link>http://wpgarage.com/code-snippets/how-to-list-subpages-with-title-excerpt-in-wordpress/</link>
		<comments>http://wpgarage.com/code-snippets/how-to-list-subpages-with-title-excerpt-in-wordpress/#comments</comments>
		<pubDate>Thu, 12 Apr 2012 08:55:33 +0000</pubDate>
		<dc:creator>Rebecca Markowitz</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[child page]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[excerpt]]></category>
		<category><![CDATA[parent page]]></category>
		<category><![CDATA[subpages]]></category>
		<category><![CDATA[title]]></category>

		<guid isPermaLink="false">http://wpgarage.com/?p=1268</guid>
		<description><![CDATA[<p>We developed a site that has really rich subpages (child pages) but the parent page is mostly a blank placeholder that directs people to the subpages. Instead of merely leaving a blank parent page, we wanted to give a preview of the content on each of the subpages. I found the code for how to [...]</p><p>This post was originally published at <a href="http://wpgarage.com/code-snippets/how-to-list-subpages-with-title-excerpt-in-wordpress/">How to list subpages with a title and excerpt in WordPress</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://wpgarage.com/code-snippets/how-to-list-subpages-with-title-excerpt-in-wordpress/" data-url="http://illum.in/Hx7UVU" data-text="How to list subpages with a title and excerpt in WordPress" data-count="vertical" data-via="wpgarage" data-related="wpgarage"><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://wpgarage.com/code-snippets/how-to-list-subpages-with-title-excerpt-in-wordpress/&amp;layout=box_count&amp;show_faces=true&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://wpgarage.com/code-snippets/how-to-list-subpages-with-title-excerpt-in-wordpress/"></g:plusone></div></div><p>We developed a site that has really rich subpages (child pages) but the parent page is mostly a blank placeholder that directs people to the subpages. Instead of merely leaving a blank parent page, we wanted to give a preview of the content on each of the subpages. I found the code for how to do it in this post, <a href="http://wpguru.co.za/templates/page/display-title-excerpt-of-child-pages/ ">Display title &amp; excerpt of child pages</a>.  </p>
<pre class="wp-code-highlight prettyprint">get_results(&quot;SELECT * FROM $wpdb-&amp;gt;posts WHERE post_parent = &quot;.$post-&amp;gt;ID.&quot; AND post_type = 'page' ORDER BY menu_order&quot;, 'OBJECT'); ?&amp;gt;</pre>
<p>This post was originally published at <a href="http://wpgarage.com/code-snippets/how-to-list-subpages-with-title-excerpt-in-wordpress/">How to list subpages with a title and excerpt in WordPress</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://wpgarage.com/code-snippets/how-to-list-subpages-with-title-excerpt-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disclaimer popups before sending an email or submitting a comment using simple jQuery in WordPress</title>
		<link>http://wpgarage.com/code-snippets/disclaimer-popups-before-sending-an-email-or-submitting-a-comment-using-simple-jquery/</link>
		<comments>http://wpgarage.com/code-snippets/disclaimer-popups-before-sending-an-email-or-submitting-a-comment-using-simple-jquery/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 14:27:05 +0000</pubDate>
		<dc:creator>Rebecca Markowitz</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[contact]]></category>
		<category><![CDATA[disclaimer]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[mailto]]></category>
		<category><![CDATA[popup]]></category>

		<guid isPermaLink="false">http://wpgarage.com/?p=1209</guid>
		<description><![CDATA[<p>Several of our clients requested that we add popup disclaimers before someone sends an email to the site admin or before they submit a comment. Here&#8217;s a screenshot of what we&#8217;re going to do: Case 1: Add a Contact Us link to the navigation menu that triggers a disclaimer popup.   Once a visitor clicks OK, [...]</p><p>This post was originally published at <a href="http://wpgarage.com/code-snippets/disclaimer-popups-before-sending-an-email-or-submitting-a-comment-using-simple-jquery/">Disclaimer popups before sending an email or submitting a comment using simple jQuery in WordPress</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://wpgarage.com/code-snippets/disclaimer-popups-before-sending-an-email-or-submitting-a-comment-using-simple-jquery/" data-url="http://illum.in/GZGYMO" data-text="Disclaimer popups before sending an email or submitting a comment using simple jQuery in WordPress" data-count="vertical" data-via="wpgarage" data-related="wpgarage"><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://wpgarage.com/code-snippets/disclaimer-popups-before-sending-an-email-or-submitting-a-comment-using-simple-jquery/&amp;layout=box_count&amp;show_faces=true&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://wpgarage.com/code-snippets/disclaimer-popups-before-sending-an-email-or-submitting-a-comment-using-simple-jquery/"></g:plusone></div></div><p>Several of our clients requested that we add popup disclaimers before someone sends an email to the site admin or before they submit a comment. Here&#8217;s a screenshot of what we&#8217;re going to do:</p>
<p><img class="alignnone" title="popups" src="http://wpgarage.com/wp-content/uploads/2012/03/popups.png" alt="" width="384" height="211" /></p>
<h3><strong>Case 1: Add a Contact Us link to the navigation menu that triggers a disclaimer popup.</strong>  <br />
Once a visitor clicks OK, open the visitor&#8217;s email client using the mailto: function.</h3>
<ol>
<li>In the WordPress dashboard, go to Appearance > Menus and add a custom link. <br /> <img title="menumailto" src="http://wpgarage.com/wp-content/uploads/2012/03/menumailto.png" alt="" width="280" height="269" /> </li>
<li>Go to Screen Options and make sure the &#8220;CSS Classes&#8221; checbox is checked</li>
<li>In the URL field, put <em>mailto:youremail@yoursite.com </em></li>
<li>In the CSS Class, put <em>show-confirm-popup</em></li>
<li>Open up header.php</li>
<li>Check to see if you already have the jQuery library loaded on your site. If not, add the following somewhere between the opening and closing head tags 
<pre class="wp-code-highlight prettyprint">&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&quot;&gt;&lt;/script&gt;</pre>
</li>
<li>Add the following code between the opening and closing head tag. Make sure to change the text of the disclaimer.
<pre class="wp-code-highlight prettyprint">&lt;script type=&quot;text/javascript&quot;&gt;$(document).ready(function(){ $('.show-confirm-popup a').each(function(){ $(this).click(showConfirmPopup); }); }); function showConfirmPopup(){ var confirmation_text = 'Change this text. By clicking &quot;OK,&quot; you agree that you have read and understand this notice.'; return confirm(confirmation_text); }   $(function(){ }); &lt;/script&gt;</pre>
</li>
</ol>
<h3>  <strong>Case 2: Add the popup disclaimer to any link.  </strong></h3>
<ol>
<li>Add the following link structure anywhere on your site.
<pre class="wp-code-highlight prettyprint">&lt;a onclick=&quot;return showConfirmPopup();&quot; href=&quot;mailto:youremail@yoursite.com&quot;&gt;Contact Us&lt;/a&gt;; </pre>
</li>
<li>Copy the code from Step 6 and 7 from Case 1 above into header.php.</li>
</ol>
<h3><strong>Case 3: Add the popup disclaimer before a comment is submitted</strong></h3>
<ol>
<li>Open Comments.php</li>
<li>Do a search for the word &#8220;submit&#8221;</li>
<li>Add the onClick parameter to the Submit button. It will look something like this:
<pre class="wp-code-highlight prettyprint">
&lt;input name=&quot;submit&quot; type=&quot;submit&quot; id=&quot;submit&quot; tabindex=&quot;5&quot;   value=&quot;Submit Comment&quot; onClick=&quot;return showConfirmCommentPopup();&quot; /&gt;</pre>
</li>
<li>Copy the code from Step 6 and 7 from Case 1 into header.php and also in header.php, add the following function. Remember to change the text.
<pre class="wp-code-highlight prettyprint">function showConfirmCommentPopup(){ var confirmation_text = 'Change this text. By clicking &quot;OK,&quot; you agree that you have read and understand this notice.'; return confirm(confirmation_text); }  </pre>
<p>&nbsp;</p>
</li>
</ol>
<p>Big thank you to <a href="http://sinapsa.co.il">Elisha</a>!</p>
<p>This post was originally published at <a href="http://wpgarage.com/code-snippets/disclaimer-popups-before-sending-an-email-or-submitting-a-comment-using-simple-jquery/">Disclaimer popups before sending an email or submitting a comment using simple jQuery in WordPress</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://wpgarage.com/code-snippets/disclaimer-popups-before-sending-an-email-or-submitting-a-comment-using-simple-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to link author image to their previous posts in WordPress</title>
		<link>http://wpgarage.com/code-snippets/how-to-link-author-image-to-their-previous-posts-in-wordpress/</link>
		<comments>http://wpgarage.com/code-snippets/how-to-link-author-image-to-their-previous-posts-in-wordpress/#comments</comments>
		<pubDate>Tue, 31 May 2011 06:15:48 +0000</pubDate>
		<dc:creator>Rebecca Markowitz</dc:creator>
				<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">?p=1031</guid>
		<description><![CDATA[<p>It seemed so simple and straightforward to link an author&#8217;s image to their page of previous posts like http://wpgarage.com/author/Rebecca/.&#160;But for some reason I couldn&#8217;t find the solution easily with the default WordPress template tags. Template tags that I had used last time I needed this functionality were deprecated. Here&#8217;s what I did: First, I set [...]</p><p>This post was originally published at <a href="http://wpgarage.com/code-snippets/how-to-link-author-image-to-their-previous-posts-in-wordpress/">How to link author image to their previous posts in WordPress</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://wpgarage.com/code-snippets/how-to-link-author-image-to-their-previous-posts-in-wordpress/" data-url="http://illum.in/n5ETzL" data-text="How to link author image to their previous posts in WordPress" data-count="vertical" data-via="wpgarage" data-related="wpgarage"><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://wpgarage.com/code-snippets/how-to-link-author-image-to-their-previous-posts-in-wordpress/&amp;layout=box_count&amp;show_faces=true&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://wpgarage.com/code-snippets/how-to-link-author-image-to-their-previous-posts-in-wordpress/"></g:plusone></div></div><p>It seemed so simple and straightforward to link an author&#8217;s image to their page of previous posts like http://wpgarage.com/author/Rebecca/.&nbsp;But for some reason I couldn&#8217;t find the solution easily with the default <a href="http://codex.wordpress.org/Template_Tags">WordPress template tags</a>. Template tags that I had used last time I needed this functionality were deprecated.<br />
<a href="http://wpgarage.com/wp-content/uploads/2011/05/profile.png"><img title="profile" src="http://wpgarage.com/wp-content/uploads/2011/05/profile-e1306420276233.png" alt="" width="450" height="101"></a></p>
<p><strong>Here&#8217;s what I did:</strong></p>
<ol>
<li>First, I set up the author image using the <a href="http://wordpress.org/extend/plugins/sem-author-image/">Author Image plugin</a> to give our client an easy way to manage thumbnails of each author from the user&#8217;s profile settings.</li>
<li>Then I started looking for a way to link the author&#8217;s image to their archive. When I couldn&#8217;t find an easy answer in the WordPress template tags, I remembered that WPGarage has that feature in the footer area of each post! So I checked out the code of WPGlide theme (the theme we use on this site by <a href="https://www.e-junkie.com/ecom/gb.php?ii=662749&amp;c=ib&amp;aff=16393&amp;cl=11384">Solostream</a>), found the code I needed and modified it.Here&#8217;s the code I used:</li>
</ol>
<p>&lt;a href=&#8221;&lt;?php bloginfo(&#8216;url&#8217;); ?&gt;/author/&lt;?php  the_author_meta(&#8216;user_login&#8217;); ?&gt;/&#8221;&gt; <strong>&lt;?php the_author_image();  ?&gt; </strong>&lt;/a&gt;</p>
<p>This post was originally published at <a href="http://wpgarage.com/code-snippets/how-to-link-author-image-to-their-previous-posts-in-wordpress/">How to link author image to their previous posts in WordPress</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://wpgarage.com/code-snippets/how-to-link-author-image-to-their-previous-posts-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Allow Editor access level to add users in WordPress</title>
		<link>http://wpgarage.com/code-snippets/allow-editor-access-level-to-add-users-in-wordpress/</link>
		<comments>http://wpgarage.com/code-snippets/allow-editor-access-level-to-add-users-in-wordpress/#comments</comments>
		<pubDate>Sun, 29 May 2011 08:23:04 +0000</pubDate>
		<dc:creator>Rebecca Markowitz</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">?p=1020</guid>
		<description><![CDATA[<p>Recently, a client asked us to allow editors to add users on their WordPress site. They wanted this feature so that the site managers wouldn&#8217;t be tempted to click on any of the settings, and possibly mess something up. I know this is super specific but it did come up for us so maybe it [...]</p><p>This post was originally published at <a href="http://wpgarage.com/code-snippets/allow-editor-access-level-to-add-users-in-wordpress/">Allow Editor access level to add users in WordPress</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://wpgarage.com/code-snippets/allow-editor-access-level-to-add-users-in-wordpress/" data-url="http://illum.in/pyCoBL" data-text="Allow Editor access level to add users in WordPress" data-count="vertical" data-via="wpgarage" data-related="wpgarage"><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://wpgarage.com/code-snippets/allow-editor-access-level-to-add-users-in-wordpress/&amp;layout=box_count&amp;show_faces=true&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://wpgarage.com/code-snippets/allow-editor-access-level-to-add-users-in-wordpress/"></g:plusone></div></div><p>Recently, a client asked us to allow editors to add users on their WordPress site. They wanted this feature so that the site managers wouldn&#8217;t be tempted to click on any of the settings, and possibly mess something up. I know this is super specific but it did come up for us so maybe it will be relevant for you.</p>
<p>Here&#8217;s what I did:</p>
<ol>
<li>Install and activate the <a href="http://wordpress.org/extend/plugins/members/">Members Plugin</a></li>
<li>Go to Settings &gt; Members Components and activate the Edit Roles component<br />
<a href="http://wpgarage.com/wp-content/uploads/2011/05/roles.png"><img title="roles" src="http://wpgarage.com/wp-content/uploads/2011/05/roles-e1306417148772.png" alt="" width="450" height="382" /></a></li>
<li>Go to Users &gt; Roles. Click on Editor. In the options panel, check off create_users, edit_users, and delete_users.<br />
<img title="capabilities" src="http://wpgarage.com/wp-content/uploads/2011/05/capabilities-e1306417194666.png" alt="" width="450" height="353" /></li>
<li>Add <a href="http://wordpress.stackexchange.com/questions/4479/editor-can-create-any-new-user-except-administrator">this code</a> into your funcitons.php file.</li>
<li>Test it out.</li>
<li>That&#8217;s it.</li>
</ol>
<p>This post was originally published at <a href="http://wpgarage.com/code-snippets/allow-editor-access-level-to-add-users-in-wordpress/">Allow Editor access level to add users in WordPress</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://wpgarage.com/code-snippets/allow-editor-access-level-to-add-users-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The ultimate guide to embedding HTML and iframes in WordPress &#8211; part 2</title>
		<link>http://wpgarage.com/code-snippets/embedding-html-and-iframes-in-wordpress-2/</link>
		<comments>http://wpgarage.com/code-snippets/embedding-html-and-iframes-in-wordpress-2/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 11:47:11 +0000</pubDate>
		<dc:creator>Miriam Schwab</dc:creator>
				<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">?p=944</guid>
		<description><![CDATA[<p>Recently, I wrote about how WordPress users can easily add media like YouTube videos to posts and pages by just inserting the URL of the page the media is on. But that functionality was limited to sites that are oEmbed providers. We are still left with the problem of not being able to insert non-oEmbed [...]</p><p>This post was originally published at <a href="http://wpgarage.com/code-snippets/embedding-html-and-iframes-in-wordpress-2/">The ultimate guide to embedding HTML and iframes in WordPress &#8211; part 2</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://wpgarage.com/code-snippets/embedding-html-and-iframes-in-wordpress-2/" data-url="http://illum.in/qcaqm9" data-text="The ultimate guide to embedding HTML and iframes in WordPress &#8211; part 2" data-count="vertical" data-via="wpgarage" data-related="wpgarage"><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://wpgarage.com/code-snippets/embedding-html-and-iframes-in-wordpress-2/&amp;layout=box_count&amp;show_faces=true&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://wpgarage.com/code-snippets/embedding-html-and-iframes-in-wordpress-2/"></g:plusone></div></div><p>Recently, I wrote about how <a title="The ultimate guide to embedding HTML and iframes in WordPress" href="tips/embed-html-iframes-wordpress/">WordPress users can easily add media like YouTube videos</a> to posts and pages by just inserting the URL of the page the media is on. But that functionality was limited to sites that are <a title="oEmbed" href="http://www.oembed.com/">oEmbed</a> providers. We are still left with the problem of not being able to insert non-oEmbed iframes in WordPress, like Google Forms for example. If you try to insert a Google Form in the WordPress editor, you may find that all of the HTML is stripped out and you&#8217;re just left with a lonely &#8220;Loading&#8230;&#8221; on your page.</p>
<p>Well, there&#8217;s a solution. There&#8217;s an awesome thread on WordPress StackExchange with a <a title="Best Collection of Code for your functions.php file" href="http://wordpress.stackexchange.com/questions/1567/best-collection-of-code-for-your-functions-php-file?page=2&amp;tab=votes#tab-top" target="_blank">collection of code for the functions.php file</a>, including the following:</p>
<p><code>// make TinyMCE allow iframes<br />
add_filter('tiny_mce_before_init', create_function( '$a',<br />
'$a["extended_valid_elements"] = "iframe[id|class|title|style|align|frameborder|height|longdesc|marginheight|marginwidth|name|scrolling|src|width]"; return $a;') );</code></p>
<p>Copy and paste the code into your WordPress functions.php file, and now you can embed any ol&#8217; iframe you want in your WordPress editor, and it won&#8217;t get stripped out!</p>
<p>Happy embedding!</p>
<p>This post was originally published at <a href="http://wpgarage.com/code-snippets/embedding-html-and-iframes-in-wordpress-2/">The ultimate guide to embedding HTML and iframes in WordPress &#8211; part 2</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://wpgarage.com/code-snippets/embedding-html-and-iframes-in-wordpress-2/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to remove the link to parent pages when using wp_list_pages in WordPress navigation</title>
		<link>http://wpgarage.com/code-snippets/how-to-remove-the-link-to-parent-pages-when-using-wp_list_pages-in-wordpress-navigation/</link>
		<comments>http://wpgarage.com/code-snippets/how-to-remove-the-link-to-parent-pages-when-using-wp_list_pages-in-wordpress-navigation/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 15:11:31 +0000</pubDate>
		<dc:creator>David Stein</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[digitalpoint]]></category>
		<category><![CDATA[Navigation bar]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">?p=810</guid>
		<description><![CDATA[<p>Recently I was working on a client&#8217;s WordPress website and he made an interesting request, that I am actually surprised we don&#8217;t see more often. He wanted the top links on his navigation bar to not be live links, and only the sub-pages should actually link to pages on his site. In this case the [...]</p><p>This post was originally published at <a href="http://wpgarage.com/code-snippets/how-to-remove-the-link-to-parent-pages-when-using-wp_list_pages-in-wordpress-navigation/">How to remove the link to parent pages when using wp_list_pages in WordPress navigation</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://wpgarage.com/code-snippets/how-to-remove-the-link-to-parent-pages-when-using-wp_list_pages-in-wordpress-navigation/" data-url="http://illum.in/n9egrz" data-text="How to remove the link to parent pages when using wp_list_pages in WordPress navigation" data-count="vertical" data-via="wpgarage" data-related="wpgarage"><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://wpgarage.com/code-snippets/how-to-remove-the-link-to-parent-pages-when-using-wp_list_pages-in-wordpress-navigation/&amp;layout=box_count&amp;show_faces=true&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://wpgarage.com/code-snippets/how-to-remove-the-link-to-parent-pages-when-using-wp_list_pages-in-wordpress-navigation/"></g:plusone></div></div><p>Recently I was working on a client&#8217;s WordPress website and he made an interesting request, that I am actually surprised we don&#8217;t see more often. He wanted the top links on his navigation bar to not be live links, and only the sub-pages should actually link to pages on his site.</p>
<p>In this case the top page on the navigation bar was called Galleries, which is the parent page for sub-pages with galleries for wedding photos, wedding videos etc. He didn&#8217;t want a main galleries page, but instead he wanted it to be a kind of folder for categorizing the various galleries he was going to have on other pages in his site.</p>
<p>Since we are using wp_list_pages, we can&#8217;t unlink each page on an individual basis since the navigation bar is dynamically formed. So I needed some way to keep using wp_list_pages so that the client can control the navigation bar, but unlink the top Galleries page.</p>
<p>I found the answer on what I think is one of the best forums around of internet and computer experts and people who are eager to help one another: <a title="Digital Point Forums" href="http://forums.digitalpoint.com/" target="_blank">Digital Point</a>.</p>
<p>After a few suggestions from people on the forums, <a title="Navigation bar links" href="http://forums.digitalpoint.com/showthread.php?t=1843887#post14451958" target="_blank">I finally got an answer</a> from the awesome <a title="bvraghav" href="http://forums.digitalpoint.com/member.php?u=432200">bvraghav</a>.</p>
<p>In the header.php section of the file I embeded a javascript code that looked like this:<br />
<code><br />
&lt;script type="text/javascript"&gt;<br />
jQuery(function($) {<br />
$("li.page-item-283").children("a").attr('href', "javascript:void(0)");<br />
});<br />
&lt;/script&gt;<br />
&lt;script type="text/javascript"&gt;jQuery(function($) {    $("li.page-item-283").children("a").attr('href', "javascript:void(0)");});&lt;/script&gt;<br />
</code><br />
This is how it works:</p>
<ul>
<li> The  jquery (a javascript framework) is used to replace the value of href  property in the required html node ( &lt;a  href=&#8221;your-galleries-link&#8221;&gt;&#8230;. &lt;/a&gt; in this case) with  &#8220;javascript:void(0)&#8221;.  Looks like this:  jQuery(function($) {</li>
</ul>
<ul>
<li>The following code selects the li element with: $(&#8220;li.page-item-283&#8243;). In this case 283 the page number that we want to void the link for (in our case the top Galleries page).</li>
</ul>
<ul>
<li>The next part is the  children function which selects all immediate children with tag a: children(&#8220;a&#8221;) . This relates t<span style="color: red;"><span style="color: #000000;">he child pages to the gallery pages and keeps their links. </span><br />
</span></li>
</ul>
<ul>
<li>After this I had to change the attribute href to &#8220;javascript:void(0)&#8221;, which looks like this:  .attr(&#8216;href&#8217;, &#8220;javascript:void(0)&#8221;); This turns th<span style="color: red;"><span style="color: #000000;">e gallery link into void so it won&#8217;t direct anywhere.</span><br />
</span></li>
</ul>
<p>All this comes together to look like the code above.</p>
<p>If you want to make all top level links unlinked, use the following code:</p>
<pre class="wp-code-highlight prettyprint">&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
jQuery(function($) {
    $(&quot;li.page_item&quot;).children(&quot;a&quot;).attr('href', &quot;javascript:void(0)&quot;); });
&amp;lt;/script&amp;gt;</pre>
<p>What I&#8217;m wondering is if the new WordPress navigation system allows users to include items in navigation bars that don&#8217;t actually lead anywhere. Anyone know?</p>
<p>This post was originally published at <a href="http://wpgarage.com/code-snippets/how-to-remove-the-link-to-parent-pages-when-using-wp_list_pages-in-wordpress-navigation/">How to remove the link to parent pages when using wp_list_pages in WordPress navigation</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://wpgarage.com/code-snippets/how-to-remove-the-link-to-parent-pages-when-using-wp_list_pages-in-wordpress-navigation/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Automatic Plugin Upgrade broken after WordPress 2.9.2 and some fixes</title>
		<link>http://wpgarage.com/code-snippets/automatic-plugin-upgrade-broken-after-wordpress-2-9-2-and-some-fixes/</link>
		<comments>http://wpgarage.com/code-snippets/automatic-plugin-upgrade-broken-after-wordpress-2-9-2-and-some-fixes/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 06:43:25 +0000</pubDate>
		<dc:creator>Rebecca Markowitz</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[automatic upgrade]]></category>
		<category><![CDATA[find content directory]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[remove old plugin]]></category>

		<guid isPermaLink="false">?p=712</guid>
		<description><![CDATA[<p>After manually upgrading one of our client&#8217;s sites to WordPress 2.9.2. we noticed that the only thing that went awry was the automatic plugin upgrade. WP asked me for the FTP information, and then gave me this error message: Cannot find Content directory (WP-Content) The first solution I found suggested to make sure that all [...]</p><p>This post was originally published at <a href="http://wpgarage.com/code-snippets/automatic-plugin-upgrade-broken-after-wordpress-2-9-2-and-some-fixes/">Automatic Plugin Upgrade broken after WordPress 2.9.2 and some fixes</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://wpgarage.com/code-snippets/automatic-plugin-upgrade-broken-after-wordpress-2-9-2-and-some-fixes/" data-url="http://illum.in/qlQzSj" data-text="Automatic Plugin Upgrade broken after WordPress 2.9.2 and some fixes" data-count="vertical" data-via="wpgarage" data-related="wpgarage"><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://wpgarage.com/code-snippets/automatic-plugin-upgrade-broken-after-wordpress-2-9-2-and-some-fixes/&amp;layout=box_count&amp;show_faces=true&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://wpgarage.com/code-snippets/automatic-plugin-upgrade-broken-after-wordpress-2-9-2-and-some-fixes/"></g:plusone></div></div><div>
<div>
<p>After manually upgrading one of our client&#8217;s sites to WordPress 2.9.2. we noticed that the only thing that went awry was the automatic plugin upgrade.</p>
<p>WP asked me for the FTP information, and then gave me this error message:</p>
<p><strong>Cannot find Content directory (WP-Content)</strong></p>
<p>The first solution I found suggested to make sure that all the necessary folders and files had a permission level of 755 or 777 (wp-content folder, plugin folder, upgrade folder) and to  add the following to the wp-config file as indicated by<a href="http://www.hui-wang.info/2009/06/unable-to-locate-wordpress-content-directory-wp-content/"> Hui Wang</a>:</p>
<div>
<div>
<blockquote><p>if(is_admin()) {<br />
add_filter(&#8216;filesystem_method&#8217;, create_function(&#8216;$a&#8217;, &#8216;return &#8220;direct&#8221;;&#8217; ));<br />
define( &#8216;FS_CHMOD_DIR&#8217;, 0751 );<br />
}</p></blockquote>
</div>
</div>
<p>But,  this caused the plugin list to show duplicate plugins &#8211; the older version and the upgraded version of the plugin. For some reason, it wasn&#8217;t deleting the old files.</p>
<p>Then, I tried deleting the code from the wp-config and trying again.  This time, I got a different error (don&#8217;t ask me why):</p>
<p><strong>Could not remove the old plugin</strong></p>
<p><strong>Plugin upgrade Failed</strong></p>
<p>So I found this<a href="http://wordpress.org/support/topic/266008"> fix from the Support Forum</a><strong> </strong>which seems to have fixed everything for now. <strong> </strong></p>
<div>
<div>
<div>
<div>
<blockquote><p>1. Make sure your wp-config.php file is chmodded to 0644.</p>
<p>2. Also make sure your .htaccess file is protecting the wp-config file using these lines:</p>
<p>&lt;Files wp-config.php&gt;<br />
order allow,deny<br />
deny from all<br />
&lt;/Files&gt;</p>
<p>3. Backup your wp-config.php file.</p>
<p>4. Edit your wp-config.php file putting these lines in underneath &lt;?php:</p>
<p>define(&#8216;FS_METHOD&#8217;, &#8216;ftpsockets&#8217;);<br />
define(&#8216;FTP_BASE&#8217;, &#8216;/path/to/wordpress/&#8217;);<br />
define(&#8216;FTP_CONTENT_DIR&#8217;, &#8216;/path/to/wordpress/wp-content/&#8217;);<br />
define(&#8216;FTP_PLUGIN_DIR &#8216;, &#8216;/path/to/wordpress/wp-content/plugins/&#8217;);<br />
define(&#8216;FTP_USER&#8217;, &#8216;username&#8217;);<br />
define(&#8216;FTP_PASS&#8217;, &#8216;password&#8217;);<br />
define(&#8216;FTP_HOST&#8217;, &#8216;<a href="http://ftp.example.org/" target="_blank">ftp.example.org</a>&#8216;);</p></blockquote>
<p>Crossing our fingers that the automatic upgrade to version 3.0 will go smoothly!</p>
</div>
</div>
</div>
</div>
</div>
</div>
<p>This post was originally published at <a href="http://wpgarage.com/code-snippets/automatic-plugin-upgrade-broken-after-wordpress-2-9-2-and-some-fixes/">Automatic Plugin Upgrade broken after WordPress 2.9.2 and some fixes</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://wpgarage.com/code-snippets/automatic-plugin-upgrade-broken-after-wordpress-2-9-2-and-some-fixes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to create an archive based on custom fields, not publish date in WordPress</title>
		<link>http://wpgarage.com/code-snippets/how-to-create-an-archive-based-on-custom-fields-not-publish-date-in-wordpress/</link>
		<comments>http://wpgarage.com/code-snippets/how-to-create-an-archive-based-on-custom-fields-not-publish-date-in-wordpress/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 13:06:11 +0000</pubDate>
		<dc:creator>Rebecca Markowitz</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[archives]]></category>
		<category><![CDATA[custom field]]></category>
		<category><![CDATA[dates]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[publish dates]]></category>

		<guid isPermaLink="false">?p=699</guid>
		<description><![CDATA[<p>We recently launched a site called theforgottenletters.org, an incredible project dedicated to translating the Holocaust-era letters of Ralph Schwab from German to English. While building the site, we needed to archive the letters based on the dates the letters were written, not when we publish them to the site. First, I tried this tutorial: How [...]</p><p>This post was originally published at <a href="http://wpgarage.com/code-snippets/how-to-create-an-archive-based-on-custom-fields-not-publish-date-in-wordpress/">How to create an archive based on custom fields, not publish date in WordPress</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://wpgarage.com/code-snippets/how-to-create-an-archive-based-on-custom-fields-not-publish-date-in-wordpress/" data-url="http://illum.in/oU47tn" data-text="How to create an archive based on custom fields, not publish date in WordPress" data-count="vertical" data-via="wpgarage" data-related="wpgarage"><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://wpgarage.com/code-snippets/how-to-create-an-archive-based-on-custom-fields-not-publish-date-in-wordpress/&amp;layout=box_count&amp;show_faces=true&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://wpgarage.com/code-snippets/how-to-create-an-archive-based-on-custom-fields-not-publish-date-in-wordpress/"></g:plusone></div></div><p>We recently launched a site called <a href="http://theforgottenletters.org">theforgottenletters.org</a>, an incredible project dedicated to translating the Holocaust-era letters of Ralph Schwab from German to English. While building the site, we needed to archive the letters based on the dates the letters were written, not when we publish them to the site.</p>
<p>First, I tried this <a href="http://www.problogdesign.com/wordpress/how-to-make-a-wordpress-events-list/">tu</a><a href="http://www.problogdesign.com/wordpress/how-to-make-a-wordpress-events-list/">torial: How To Make a WordPress Events List</a> and <a href="plugins/wordpress-calendar-plugins/">calendar plugins</a>, but the tutorial wasn&#8217;t comprehensive enough and the plugins were too complex to start messing with.</p>
<p><strong>The solution</strong></p>
<p>I found this wonderful <a href="http://matth.eu/wordpress-date-field-plugin">date field plugin</a> which lets  you sort posts by the date entered in the custom fields.  Here&#8217;s what I did:</p>
<p>1. Upload the plugin and activate it</p>
<p>2. Opened the lettersarchive.php page template I created and added a query. The query checks for posts in the Letters category that have a date filled in and the orders it from oldest to newest.</p>
<p><strong>&lt;?php query_posts(&#8216;category_name=letters&amp;meta_key=date_value&amp;orderby=meta_value&amp;order=DESC&#8217;); ?&gt;</strong></p>
<p>3. I replaced a typical date function within the loop &lt;?php the_time(&#8216;j M Y&#8217;); ?&gt; with</p>
<p><strong>&lt;?php echo date(&#8220;l jS \of F Y&#8221;, get_post_meta($post-&gt;ID, &#8216;date_value&#8217;, true));?&gt;</strong></p>
<p>4. I created a new post,  assigned it to the Letters category, and selected a date from the date picker box that now appears below the editing box in the post area.<br />
<img class="alignnone size-full wp-image-701" title="adddateinfo" src="http://wpgarage.com/wp-content/uploads/2010/04/adddateinfo.png" alt="" width="309" height="120" /></p>
<p>I noticed that the Date Field plugin only lets you select a date up to 5 years ago  so I had to hack the plugin file on line 125 to  reflect selecting dates from 80 years ago.</p>
<p>for($currentyear = date(&#8216;Y&#8217;)<strong> &#8211; 80</strong>; $currentyear &lt;= date(Y) +5;$currentyear +=1)</p>
<p>Here&#8217;s a screenshot of the archive from <a href="http://theforgottenletters.org">The Forgotten Letters</a> site.</p>
<p><img class="alignnone size-full wp-image-702" title="lettersscreen" src="http://wpgarage.com/wp-content/uploads/2010/04/lettersscreen.png" alt="" width="250" height="191" /></p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">http://www.problogdesign.com/wordpress/how-to-make-a-wordpress-events-list/#comment-16409</div>
<p>This post was originally published at <a href="http://wpgarage.com/code-snippets/how-to-create-an-archive-based-on-custom-fields-not-publish-date-in-wordpress/">How to create an archive based on custom fields, not publish date in WordPress</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://wpgarage.com/code-snippets/how-to-create-an-archive-based-on-custom-fields-not-publish-date-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to list Pages with custom fields in 2 columns in WordPress</title>
		<link>http://wpgarage.com/code-snippets/how-to-list-pages-with-custom-fields-in-2-columns-in-wordpress/</link>
		<comments>http://wpgarage.com/code-snippets/how-to-list-pages-with-custom-fields-in-2-columns-in-wordpress/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 11:51:11 +0000</pubDate>
		<dc:creator>Rebecca Markowitz</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[columns]]></category>
		<category><![CDATA[custom fields]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[Pages]]></category>

		<guid isPermaLink="false">?p=695</guid>
		<description><![CDATA[<p>Recently, I needed to list all subpages of a parent page.  I also needed to display custom fields below each subpage. And, on top of that, the list needed to be 2 columns. I found a solution for simply listing the pages in 2 columns, but it did not suggest how to modify the code [...]</p><p>This post was originally published at <a href="http://wpgarage.com/code-snippets/how-to-list-pages-with-custom-fields-in-2-columns-in-wordpress/">How to list Pages with custom fields in 2 columns in WordPress</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://wpgarage.com/code-snippets/how-to-list-pages-with-custom-fields-in-2-columns-in-wordpress/" data-url="http://illum.in/oWCm4j" data-text="How to list Pages with custom fields in 2 columns in WordPress" data-count="vertical" data-via="wpgarage" data-related="wpgarage"><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://wpgarage.com/code-snippets/how-to-list-pages-with-custom-fields-in-2-columns-in-wordpress/&amp;layout=box_count&amp;show_faces=true&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://wpgarage.com/code-snippets/how-to-list-pages-with-custom-fields-in-2-columns-in-wordpress/"></g:plusone></div></div><p>Recently, I needed to list all subpages of a parent page.  I also needed to display custom fields below each subpage. And, on top of that, the list needed to be 2 columns.</p>
<p>I found a <a href="http://www.livexp.net/wordpress/display-list-of-wordpress-pages-in-two-columns.html">solution</a> for simply listing the pages in 2 columns, but it did not suggest how to modify the code to include custom fields.</p>
<p>So, thanks to our coding hero <a href="http://marksw.com/wordpress/">Mark Kaplun</a> who supplied the below code, although he admits it&#8217;s a &#8220;dirty hack&#8221;. The sort_column is so that MyPageOrder would work properly for this listing.</p>
<blockquote><p>&lt;?php<br />
$args = array(<br />
&#8216;post_type&#8217; =&gt; &#8216;page&#8217;,<br />
&#8216;numberposts&#8217; =&gt; 40,<br />
&#8216;sort_column&#8217; =&gt; &#8216;menu_order&#8217;,<br />
&#8216;child_of&#8217; =&gt; 84 // any parent<br />
);<br />
$attachments = get_pages($args);<br />
//print_r(&#8220;attachements:&#8221; . $attachements);<br />
echo &#8216;&lt;div style=&#8221;float: left; margin: 0 10px 0 0;&#8221;&gt;&#8217;;<br />
?&gt;</p>
<p>&lt;?php<br />
for ($i =0; $i&lt;count($attachments)/2; $i++) {<br />
$post = $attachments[$i];<br />
//    foreach ($attachments as $post)  { ?&gt;</p>
<p>&lt;a href=&#8221;&lt;?php echo get_permalink($post-&gt;ID) ?&gt;&#8221; rel=&#8221;bookmark&#8221;&gt;&lt;?php echo $post-&gt;post_title; ?&gt;&lt;/a&gt;<br />
&lt;?php if(get_post_meta($post-&gt;ID, &#8220;NameofCustomField&#8221;, true)) { ?&gt;<br />
&lt;?php<br />
echo get_post_meta($post-&gt;ID, &#8220;NameofCustomField&#8221;, true);<br />
}<br />
?&gt;<br />
&lt;?php } ?&gt;<br />
&lt;/div&gt;<br />
&lt;?php<br />
echo &#8216;&lt;div style=&#8221;float: left; margin: 0 10px 0 0;&#8221;&gt;&#8217;;<br />
for (; $i&lt;count($attachments); $i++) {<br />
$post = $attachments[$i];<br />
//    foreach ($attachments as $post)  { ?&gt;</p>
<p>&lt;a href=&#8221;&lt;?php echo get_permalink($post-&gt;ID) ?&gt;&#8221; rel=&#8221;bookmark&#8221;&gt;&lt;?php echo $post-&gt;post_title; ?&gt;&lt;/a&gt;<br />
&lt;?php if(get_post_meta($post-&gt;ID, &#8220;PracticeArea&#8221;, true)) { ?&gt;<br />
&lt;?php<br />
echo get_post_meta($post-&gt;ID, &#8220;PracticeArea&#8221;, true);<br />
}<br />
?&gt;<br />
&lt;?php } ?&gt;<br />
&lt;/div&gt;</p></blockquote>
<p>This post was originally published at <a href="http://wpgarage.com/code-snippets/how-to-list-pages-with-custom-fields-in-2-columns-in-wordpress/">How to list Pages with custom fields in 2 columns in WordPress</a> on <a href="http://wpgarage.com">WP Garage</a> - <a href="http://wpgarage.com">WP Garage - wordpress tricks, hacks, and tips</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://wpgarage.com/code-snippets/how-to-list-pages-with-custom-fields-in-2-columns-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

