<?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>SDAC Inc &#124; Chicagoland Web Development &#187; WordPress Logic</title> <atom:link href="http://www.sandboxdev.com/category/blog/wordpress/wordpress-logic-wordpress-blog/feed/" rel="self" type="application/rss+xml" /><link>http://www.sandboxdev.com</link> <description>Just another Sandbox Development and Consulting Inc. Sites site</description> <lastBuildDate>Wed, 25 Jan 2012 07:57:33 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>HOWTO: Make WordPress Titles Title Case</title><link>http://www.sandboxdev.com/2011/11/18/howto-make-wordpress-titles-title-case/</link> <comments>http://www.sandboxdev.com/2011/11/18/howto-make-wordpress-titles-title-case/#comments</comments> <pubDate>Fri, 18 Nov 2011 21:23:13 +0000</pubDate> <dc:creator>Jennifer Zelazny</dc:creator> <category><![CDATA[HOWTOs]]></category> <category><![CDATA[WordPress Logic]]></category> <category><![CDATA[the_title]]></category> <category><![CDATA[wp_title]]></category> <guid
isPermaLink="false">http://www.sandboxdev.com/?p=7345</guid> <description><![CDATA[Ever need to make sure all your titles showed up with using &#8220;Title Case&#8221; and not just by using CSS? By adding the following to your functions.php file in your theme &#8211; you can ensure the post title will have the case you want:]]></description> <content:encoded><![CDATA[<p>Ever need to make sure all your titles showed up with using &#8220;Title Case&#8221; and not just by using CSS? By adding the following to your functions.php file in your theme &#8211; you can ensure the post title will have the case you want:</p><pre class="brush: php; title: Custom Code; notranslate">
/**
 * Custom Title Case for the_title()
 * @returns $content (title with title case)
 */
add_filter( 'the_title', 'sdac_use_title_case' );
add_filter( 'wp_title', 'sdac_use_title_case' );
function sdac_use_title_case( $content ) {
	$content = ucwords( $content );
	return $content;
}
</pre> <script type="text/javascript">sdac_post_slideshows.push({fx: 'fade', timeout: 0, speed: 1000, pause: 0,})</script>]]></content:encoded> <wfw:commentRss>http://www.sandboxdev.com/2011/11/18/howto-make-wordpress-titles-title-case/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Change WordPress Author Permalink</title><link>http://www.sandboxdev.com/2011/10/19/change-wordpress-author-permalink/</link> <comments>http://www.sandboxdev.com/2011/10/19/change-wordpress-author-permalink/#comments</comments> <pubDate>Wed, 19 Oct 2011 16:12:55 +0000</pubDate> <dc:creator>Jennifer Zelazny</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Logic]]></category> <category><![CDATA[init]]></category> <category><![CDATA[wp_rewrite]]></category> <guid
isPermaLink="false">http://www.sandboxdev.com/?p=7326</guid> <description><![CDATA[Ever want to change the &#8220;author&#8221; permalink from something like /author/jzelazny to something more custom for your CMS like /teacher/jzelazny? This is relatively easy by adding a function to your functions.php file: Flush your permalinks (Settings > Permalinks) and now all your /author/ pages will now be /teacher/.]]></description> <content:encoded><![CDATA[<p>Ever want to change the &#8220;author&#8221; permalink from something like /author/jzelazny to something more custom for your CMS like /teacher/jzelazny?  This is relatively easy by adding a function to your functions.php file:</p><pre class="brush: php; title: Custom Code; notranslate">
// Adjust your author permalink
add_action( 'init', 'custom_theme_init' );
function custom_theme_init() {
   global $wp_rewrite;
   // Change the value of the author permalink to teacher
   $wp_rewrite-&gt;author_base = 'teacher';
}
</pre><p>Flush your permalinks (Settings > Permalinks) and now all your /author/ pages will now be /teacher/.</p> <script type="text/javascript">sdac_post_slideshows.push({fx: 'fade', timeout: 0, speed: 1000, pause: 0,})</script>]]></content:encoded> <wfw:commentRss>http://www.sandboxdev.com/2011/10/19/change-wordpress-author-permalink/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Using meta_query With WordPress 3.1+</title><link>http://www.sandboxdev.com/2011/04/14/using-meta_query-with-wordpress-3-1/</link> <comments>http://www.sandboxdev.com/2011/04/14/using-meta_query-with-wordpress-3-1/#comments</comments> <pubDate>Thu, 14 Apr 2011 18:29:58 +0000</pubDate> <dc:creator>Jennifer Zelazny</dc:creator> <category><![CDATA[SDAC Blog]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Logic]]></category> <category><![CDATA[WordPress function]]></category> <guid
isPermaLink="false">http://www.sandboxdev.com/?p=1334</guid> <description><![CDATA[With WordPress 3.1 &#8211; we now have the ability to use &#8220;meta_query&#8221; to show posts associated with a certain custom field. I recently used this in order to create an events listing widget for a client. I needed to query posts in the &#8220;Events&#8221; category and that had a time stamp defined (which happened to [...]]]></description> <content:encoded><![CDATA[<p>With WordPress 3.1 &#8211; we now have the ability to use &#8220;meta_query&#8221; to show posts associated with a certain custom field. I recently used this in order to create an events listing widget for a client.  I needed to query posts in the &#8220;Events&#8221; category and that had a time stamp defined (which happened to be the start date of the event).  The client wanted to show only current/future events (today or later) and wanted to show them in order by the closest event date to the furthest away.</p><p>Getting the general query together was a snap &#8211; but the orderby did not work unless I had the meta_key defined (this is documented but was overlooked initially).</p><p><strong>Example</strong></p><pre class="brush: php; title: Custom Code; notranslate">
$now = time();
$args = array(
	'category_name' =&amp;gt; 'Events',
	'meta_query' =&amp;gt; array(
		array(
			'key' =&amp;gt; 'sdac_event_time_stamp',
			'value' =&amp;gt; $now,
			'compare' =&amp;gt; '&amp;gt;=',
			'type' =&amp;gt; 'NUMERIC'
		)
	),
	'meta_key' =&amp;gt; 'sdac_event_time_stamp',
	'order' =&amp;gt; 'ASC',
	'orderby' =&amp;gt; 'meta_value_num'
 );
$events_query = new WP_Query( $args);
</pre><p>If you take a look at the query itself &#8211; the trick was to capture the time now ($now) and then use the compare within the meta_query.  Overall &#8211; this sort of query makes working with custom fields a lot easier.  If you have not checked it out yet &#8211; take a look.</p><p><strong>Documentation</strong><br
/> <a
href="http://codex.wordpress.org/Function_Reference/WP_Query" target="_blank">Function Reference/WP Query</a></p> <script type="text/javascript">sdac_post_slideshows.push({fx: 'fade', timeout: 0, speed: 1000, pause: 0,})</script>]]></content:encoded> <wfw:commentRss>http://www.sandboxdev.com/2011/04/14/using-meta_query-with-wordpress-3-1/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>WordPress Taxonomy Query (Keep it Simple)</title><link>http://www.sandboxdev.com/2011/02/24/wordpress-taxonomy-query-keep-it-simple/</link> <comments>http://www.sandboxdev.com/2011/02/24/wordpress-taxonomy-query-keep-it-simple/#comments</comments> <pubDate>Thu, 24 Feb 2011 20:23:26 +0000</pubDate> <dc:creator>Jennifer Zelazny</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Logic]]></category> <category><![CDATA[query_posts]]></category> <category><![CDATA[taxonomies]]></category> <guid
isPermaLink="false">http://www.sandboxdev.com/?p=1253</guid> <description><![CDATA[Now that a number of people are using more and more custom taxonomies for WordPress &#8211; custom taxonomy queries are something becoming necessary. Example: You have a WordPress site set up to show/sell products (in this example &#8211; you sell books and posters). You have a custom taxonomy called &#8220;catalog&#8221; that you use to organize [...]]]></description> <content:encoded><![CDATA[<p>Now that a number of people are using more and more custom taxonomies for WordPress &#8211; custom taxonomy queries are something becoming necessary.</p><p>Example: You have a WordPress site set up to show/sell products (in this example &#8211; you sell books and posters).  You have a custom taxonomy called &#8220;catalog&#8221; that you use to organize all the products.</p><p>If you want to show all items that are marked &#8220;posters&#8221; in your custom catalog taxonomy you can simply use this query:</p><pre class="brush: php; title: Custom Code; notranslate">
query_posts( array( 'catalog' =&amp;gt; 'posters' ) );
</pre><p>Of course &#8211; you can create more complicated custom taxonomy queries, but this will get you started.  By using custom taxonomies (and custom post types) &#8211; you can really open the door to creating complex content management systems (and/or really cool sites that need something more than your standard categories/tags/posts/pages).</p><p>Further documentation: <a
href="http://codex.wordpress.org/Function_Reference/query_posts" target="_blank">http://codex.wordpress.org/Function_Reference/query_posts</a></p><p>Remember &#8211; keep it simple!</p> <script type="text/javascript">sdac_post_slideshows.push({fx: 'fade', timeout: 0, speed: 1000, pause: 0,})</script>]]></content:encoded> <wfw:commentRss>http://www.sandboxdev.com/2011/02/24/wordpress-taxonomy-query-keep-it-simple/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Change the_excerpt Length and Ending</title><link>http://www.sandboxdev.com/2011/01/27/change-the_excerpt-length-and-ending/</link> <comments>http://www.sandboxdev.com/2011/01/27/change-the_excerpt-length-and-ending/#comments</comments> <pubDate>Thu, 27 Jan 2011 14:17:23 +0000</pubDate> <dc:creator>Jennifer Zelazny</dc:creator> <category><![CDATA[HOWTOs]]></category> <category><![CDATA[SDAC Blog]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Logic]]></category> <category><![CDATA[the_excerpt]]></category> <guid
isPermaLink="false">http://www.sandboxdev.com/?p=1176</guid> <description><![CDATA[Using WordPress &#8211; there are some times when you want to use the_excerpt but you do not want to show the default 55 words and/or show the [...] after those 55 words. Change the Length Instead of only showing the default 55 words where you want to change it to something longer or shorter. To [...]]]></description> <content:encoded><![CDATA[<p>Using WordPress &#8211; there are some times when you want to use the_excerpt but you do not want to show the default 55 words and/or show the [...] after those 55 words.</p><h4>Change the Length</h4><p> Instead of only showing the default 55 words where you want to change it to something longer or shorter.  To change this &#8211; just add/modify this in your functions.php file:</p><pre class="brush: php; title: Custom Code; notranslate">
add_filter('excerpt_length', 'sdac_excerpt_length');
function sdac_excerpt_length( $length ) {
	return 75;
}
</pre><p>In that code example &#8211; I am setting the length to be 75 words.</p><h4>Change the Ending</h4><p>Instead of showing the default [...] after the excerpt &#8211; you can omit that or change it.  To change this &#8211; just add/modify this in your functions.php file:</p><pre class="brush: php; title: Custom Code; notranslate">
add_filter('excerpt_more', 'jappler_excerpt_more');
function jappler_excerpt_more( $more ) {
        global $post;
	return '... &lt;a&gt;ID ).'&quot;&amp;gt;Read More &amp;raquo;&lt;/a&gt;';
}
</pre><p>In that example &#8211; I added a read more which links to the post permalink. (This filter is available with WordPress 2.9+)</p><p>Hopefully these examples will help a little bit the next time you want to use the excerpt but wished it was easy to change the output.</p> <script type="text/javascript">sdac_post_slideshows.push({fx: 'fade', timeout: 0, speed: 1000, pause: 0,})</script>]]></content:encoded> <wfw:commentRss>http://www.sandboxdev.com/2011/01/27/change-the_excerpt-length-and-ending/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>HOWTO: Add a Custom Comment Class to WordPress</title><link>http://www.sandboxdev.com/2009/11/30/howto-add-a-custom-comment-class-to-wordpress/</link> <comments>http://www.sandboxdev.com/2009/11/30/howto-add-a-custom-comment-class-to-wordpress/#comments</comments> <pubDate>Mon, 30 Nov 2009 17:03:20 +0000</pubDate> <dc:creator>Jennifer Zelazny</dc:creator> <category><![CDATA[SDAC Blog]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Logic]]></category> <category><![CDATA[comment_class]]></category> <category><![CDATA[WordPress functions]]></category> <guid
isPermaLink="false">http://www.sandboxdev.com/?p=782</guid> <description><![CDATA[Ever need to add your own class to your WordPress comment template but not sure how because of the function comment_class that controls the classes? Check out the function comment_class and you will see adding your own custom classes very easily. Allow this sounds pretty basic &#8211; it is a lifesaver for doing a lot [...]]]></description> <content:encoded><![CDATA[<p>Ever need to add your own class to your WordPress comment template but not sure how because of the function comment_class that controls the classes?  Check out the function <a
href="http://codex.wordpress.org/Template_Tags/comment_class" target="_blank">comment_class</a> and you will see adding your own custom classes very easily.</p><pre class="brush: php; title: Custom Code; notranslate">
</pre><p>Allow this sounds pretty basic &#8211; it is a lifesaver for doing a lot of customizations.</p> <script type="text/javascript">sdac_post_slideshows.push({fx: 'fade', timeout: 0, speed: 1000, pause: 0,})</script>]]></content:encoded> <wfw:commentRss>http://www.sandboxdev.com/2009/11/30/howto-add-a-custom-comment-class-to-wordpress/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Conditionally Show Only On Home Page (Front Page)</title><link>http://www.sandboxdev.com/2009/01/16/conditionally-show-only-on-home-page-front-page/</link> <comments>http://www.sandboxdev.com/2009/01/16/conditionally-show-only-on-home-page-front-page/#comments</comments> <pubDate>Fri, 16 Jan 2009 20:59:00 +0000</pubDate> <dc:creator>Jennifer Zelazny</dc:creator> <category><![CDATA[HOWTOs]]></category> <category><![CDATA[SDAC Blog]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Logic]]></category> <category><![CDATA[WordPress Themes]]></category> <category><![CDATA[WordPress Troubleshooting]]></category> <category><![CDATA[Conditional Tags]]></category> <category><![CDATA[is_font_page]]></category> <guid
isPermaLink="false">http://www.sandboxdev.com/?p=521</guid> <description><![CDATA[There a are two functions that are used quite a bit to conditionally show content on the very front page (home page or page 1 of your blog). First &#8211; we had the function is_home(), but in WordPress version 2.5 &#8211; a new function was introduced: is_front_page(). You might think both would conditionally only display [...]]]></description> <content:encoded><![CDATA[<p>There a are two functions that are used quite a bit to conditionally show content on the very front page (home page or page 1 of your blog).  First &#8211; we had the function is_home(), but in WordPress version 2.5 &#8211; a new function was introduced: is_front_page().</p><p>You might think both would conditionally only display content on the home page (front page, page 1 of your blog) &#8211; but you actually need to use the following code to accomplish showing something <strong>ONLY</strong> on the front page of your paged blog:</p><pre class="brush: php; title: Custom Code; notranslate">
&lt;p&gt;Show this text only on the home page&lt;/p&gt;
</pre><p>So &#8211; if you want to easily show something on what I would consider the front page &#8211; use the code above to successfully achieve that.  (This is particularly helpful if you have ads that run speficically on the home page and others that are ROS (run of site).</p><p><strong>Further reading:</strong></p><ul><li><a
href="http://codex.wordpress.org/Conditional_Tags">documentation on conditional tags</a></li><li><a
href="http://trac.wordpress.org/ticket/6848">Bug Report on this issue</a></li></ul> <script type="text/javascript">sdac_post_slideshows.push({fx: 'fade', timeout: 0, speed: 1000, pause: 0,})</script>]]></content:encoded> <wfw:commentRss>http://www.sandboxdev.com/2009/01/16/conditionally-show-only-on-home-page-front-page/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Get Top Parent Category (WordPress)</title><link>http://www.sandboxdev.com/2009/01/15/get-top-parent-category-wordpress/</link> <comments>http://www.sandboxdev.com/2009/01/15/get-top-parent-category-wordpress/#comments</comments> <pubDate>Thu, 15 Jan 2009 15:28:16 +0000</pubDate> <dc:creator>Jennifer Zelazny</dc:creator> <category><![CDATA[Clients]]></category> <category><![CDATA[HOWTOs]]></category> <category><![CDATA[SDAC Blog]]></category> <category><![CDATA[WordPress Logic]]></category> <category><![CDATA[get_cateogry_parents]]></category> <category><![CDATA[jappler.com]]></category> <category><![CDATA[WordPress]]></category> <guid
isPermaLink="false">http://www.sandboxdev.com/?p=518</guid> <description><![CDATA[There are many times when you need to show or get the top most (root) parent category in WordPress &#8211; regardless of how many subcategories you might be deep. I have used this logic for page navigation (highlight the top parent tab) &#8211; as well as within some custom loops/sidebar code. They way to do [...]]]></description> <content:encoded><![CDATA[<p>There are many times when you need to show or get the top most (root) parent category in WordPress &#8211; regardless of how many subcategories you might be deep.  I have used this logic for page navigation (highlight the top parent tab) &#8211; as well as within some custom loops/sidebar code.</p><p>They way to do this:</p><pre class="brush: php; title: Custom Code; notranslate">
// get parent category slug
$parentCatList = get_category_parents($cat,false,',');
$parentCatListArray = split(&quot;,&quot;,$parentCatList);
$topParentName = $parentCatListArray[0];
$sdacReplace = array(&quot; &quot; =&gt; &quot;-&quot;, &quot;(&quot; =&gt; &quot;&quot;, &quot;)&quot; =&gt; &quot;&quot;);
$topParent = strtolower(strtr($topParentName,$sdacReplace));
</pre><p>To test this you can simply put it in your header and echo out $topParent and you will see the &#8220;slug&#8221; of the category.<br
/> If you want to see the category name and not necessarily the slug &#8211; you can simply echo $topParentName.</p> <script type="text/javascript">sdac_post_slideshows.push({fx: 'fade', timeout: 0, speed: 1000, pause: 0,})</script>]]></content:encoded> <wfw:commentRss>http://www.sandboxdev.com/2009/01/15/get-top-parent-category-wordpress/feed/</wfw:commentRss> <slash:comments>44</slash:comments> </item> <item><title>Show One WordPress Post</title><link>http://www.sandboxdev.com/2008/11/04/show-one-wordpress-post/</link> <comments>http://www.sandboxdev.com/2008/11/04/show-one-wordpress-post/#comments</comments> <pubDate>Wed, 05 Nov 2008 02:47:23 +0000</pubDate> <dc:creator>Jennifer Zelazny</dc:creator> <category><![CDATA[HOWTOs]]></category> <category><![CDATA[SDAC Blog]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Logic]]></category> <category><![CDATA[get_post]]></category> <category><![CDATA[WordPress functions]]></category> <guid
isPermaLink="false">http://www.sandboxdev.com/?p=411</guid> <description><![CDATA[There is a great function you might be aware of that allows you to get one WordPress post and display it anywhere you would like (header, sidebar, home page, etc). To show only one post, use the function get_post. Example: The code above will show the title and content of the post with the post [...]]]></description> <content:encoded><![CDATA[<p>There is a great function you might be aware of that allows you to get one WordPress post and display it anywhere you would like (header, sidebar, home page, etc).</p><p>To show only one post, use the function <a
href="http://codex.wordpress.org/Function_Reference/get_post">get_post</a>.</p><p><strong>Example:</strong></p><pre class="brush: php; title: Custom Code; notranslate">
post_title;
$sdac_content = $show_post_id-&amp;gt;post_content;
?&amp;gt;
&lt;h2&gt;&lt;/h2&gt;
</pre><p>The code above will show the title and content of the post with the post ID of 10.  If you are not sure what your post ID is, go to the manage screen in the WP-Admin, and hover over the post title.  In your browser status bar, you will see the URL &#8211; and the post ID is the number at the end of the URL.</p> <script type="text/javascript">sdac_post_slideshows.push({fx: 'fade', timeout: 0, speed: 1000, pause: 0,})</script>]]></content:encoded> <wfw:commentRss>http://www.sandboxdev.com/2008/11/04/show-one-wordpress-post/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Show Only Category (Not Subcategory) Content</title><link>http://www.sandboxdev.com/2008/06/17/show-only-category-not-subcategory-content/</link> <comments>http://www.sandboxdev.com/2008/06/17/show-only-category-not-subcategory-content/#comments</comments> <pubDate>Tue, 17 Jun 2008 13:12:24 +0000</pubDate> <dc:creator>Jennifer Zelazny</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Logic]]></category> <category><![CDATA[category]]></category> <category><![CDATA[conditional]]></category> <guid
isPermaLink="false">http://www.sandboxdev.com/?p=210</guid> <description><![CDATA[If you ever wanted to only show the content of the category you were on in the category view of WordPress (instead of the category you are on plus all of it&#8217;s subcategories &#8211; you can easily do so by adding the code below to the template that is used to show your category content [...]]]></description> <content:encoded><![CDATA[<p>If you ever wanted to only show the content of the category you were on in the category view of WordPress (instead of the category you are on plus all  of it&#8217;s subcategories &#8211; you can easily do so by adding the code below to <a
href="http://codex.wordpress.org/Template_Hierarchy">the template that is used to show your category content</a></p><p>You would start your loop with this:</p><pre class="brush: php; title: Custom Code; notranslate"> </pre><p>Put your title, content functions here</p><p>and where you normally see the  call, put  to close the additional (in_category) if statement.</p><p>This code gets the current category and then only displays categories that are in that category (not sub category)</p> <script type="text/javascript">sdac_post_slideshows.push({fx: 'fade', timeout: 0, speed: 1000, pause: 0,})</script>]]></content:encoded> <wfw:commentRss>http://www.sandboxdev.com/2008/06/17/show-only-category-not-subcategory-content/feed/</wfw:commentRss> <slash:comments>11</slash:comments> </item> </channel> </rss>
