<?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>TransformationPowerTools &#187; Wordpress</title>
	<atom:link href="http://www.transformationpowertools.com/wordpress/tag/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://www.transformationpowertools.com/wordpress</link>
	<description>for personal growth and transformation</description>
	<lastBuildDate>Fri, 20 Jan 2012 13:23:43 +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>WordPress Post Thumbnails with Caption</title>
		<link>http://www.transformationpowertools.com/wordpress/wordpress-post-thumbnails-with-caption</link>
		<comments>http://www.transformationpowertools.com/wordpress/wordpress-post-thumbnails-with-caption#comments</comments>
		<pubDate>Thu, 05 Jan 2012 19:26:06 +0000</pubDate>
		<dc:creator>alchymyth</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[caption]]></category>
		<category><![CDATA[support forum]]></category>
		<category><![CDATA[thumbnail]]></category>

		<guid isPermaLink="false">http://www.transformationpowertools.com/wordpress/?p=1473</guid>
		<description><![CDATA[This is a tidying up of a WordPress support forum topic &#8211; nothing really that I came up with myself. The question is how to post the caption with a post thumbnail, aka featured image, in an ordered way. This &#8230; <a href="http://www.transformationpowertools.com/wordpress/wordpress-post-thumbnails-with-caption">capture it all ... <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is a tidying up of a <a title="WordPress support forum link" href="http://wordpress.org/support/" target="_blank">WordPress support forum</a> topic &#8211; nothing really that I came up with myself.</p>
<p>The question is how to post the caption with a post thumbnail, aka featured image, in an ordered way.</p>
<p>This code below is tested in wp3.3.</p>
<pre class="brush: php; title: ; notranslate">//POST THUMBNAIL AND CAPTION STYLED SIMILAR TO .wp-caption//
function the_post_thumbnail_and_caption($size = '', $attr = '') {
global $post;

$thumb_id = get_post_thumbnail_id($post-&gt;id);

$args = array(
'post_type' =&gt; 'attachment',
'post_status' =&gt; null,
'parent' =&gt; $post-&gt;ID,
'include'  =&gt; $thumb_id
);

$thumbnail_image = get_posts($args);

if ($thumb_id &amp;&amp; $thumbnail_image &amp;&amp; isset($thumbnail_image[0])) {

$image = wp_get_attachment_image_src( $thumb_id, $size );
$image_width = $image[1];

$output = '&lt;div style=&quot;width: ' . ($image_width) . 'px&quot;&gt;';

$attr['class'] = ''; //move any 'class' attributes to the outer div, and remove from the thumbnail

$output .= get_the_post_thumbnail($post-&gt;ID, $size, $attr);

/* //Uncomment to show thumbnail title
$title = $thumbnail_image[0]-&gt;post_title;
if($title) :
$output .= '&lt;p&gt;';
$output .= $title;
$output .= '&lt;/p&gt;';
endif; */

/* //Uncomment to show the thumbnail caption */
$caption = $thumbnail_image[0]-&gt;post_excerpt;
if($caption) :
$output .= '&lt;p&gt;';
$output .= $caption;
$output .= '&lt;/p&gt;';
endif;

/* //Uncomment to show the thumbnail description
$descr = $thumbnail_image[0]-&gt;post_content;
if($descr) :
$output .= '&lt;p&gt;';
$output .= $descr;
$output .= '&lt;/p&gt;';
endif; */

/* //Uncomment to show the thumbnail alt field
$alt = get_post_meta($thumb_id, '_wp_attachment_image_alt', true);
if(count($alt)) :
$output .= '&lt;p&gt;';
$output .= $alt;
$output .= '&lt;/p&gt;';
endif; */

$output .= '&lt;/div&gt;';

}
echo $output;
}
</pre>
<p>(unfortunately, posting here removes the indents which would make the code easier to read)</p>
<p>Possible styles for that to make it look like an ordinary wp caption:</p>
<pre class="brush: css; title: ; notranslate">.thumbnail-caption { padding: 5px; background: #f5f5f5; border: 1px solid #ddd; }
.thumbnail-caption-text { text-align: center; margin-bottom: 5px; font-size: 90%; }
/*
.thumbnail-title-text { text-align: center; margin-bottom: 5px; font-size: 90%; }
.thumbnail-description-text { text-align: center; margin-bottom: 5px; font-size: 90%; }
.thumbnail-alt-text { text-align: center; margin-bottom: 5px; font-size: 90%; }
*/</pre>
<p>Use the code in the template, for instance in single.php, with one of the registered thumbnail sizes as parameter; example:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php the_post_thumbnail_and_caption('large',array('class' =&gt; 'alignleft')); ?&gt;</pre>
<p>A huge &#8216;thank you&#8217; to all the contributers to <a href="http://wordpress.org/support/topic/display-caption-with-the_post_thumbnail" target="_blank">this topic</a> in the forum.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.transformationpowertools.com/wordpress/wordpress-post-thumbnails-with-caption/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Styling the First Post Different</title>
		<link>http://www.transformationpowertools.com/wordpress/styling-first-post-different</link>
		<comments>http://www.transformationpowertools.com/wordpress/styling-first-post-different#comments</comments>
		<pubDate>Wed, 07 Sep 2011 12:02:54 +0000</pubDate>
		<dc:creator>alchymyth</dc:creator>
				<category><![CDATA[Easy Coding for Wordpress]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[conditional tag]]></category>
		<category><![CDATA[different style]]></category>
		<category><![CDATA[first post]]></category>
		<category><![CDATA[last post]]></category>
		<category><![CDATA[latest post]]></category>

		<guid isPermaLink="false">http://www.transformationpowertools.com/wordpress/?p=1346</guid>
		<description><![CDATA[How to style the first / last / latest / newest post in a WordPress site different? The default advice usually is to use a counter variable and a conditional statement to check for the first post in the loop; &#8230; <a href="http://www.transformationpowertools.com/wordpress/styling-first-post-different">Check the whole post <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>How to style the first / last / latest / newest post in a WordPress site different?</p>
<p>The default advice usually is to use a counter variable and a conditional statement to check for the first post in the loop; that approach obviously works fine, however requires a few lines of extra code before and in the loop.</p>
<p>A more condensed approach is to use <code>$wp_query-&gt;current_post<!--formatted--></code> which returns the current post number in the loop, starting with 0 (zero) for the first post.</p>
<p>This can be combined with a check, if the page is really the first page, and not one of the paginated pages, using <code>!is_paged()</code>.</p>
<p>If the goal is just to apply different css styles to the first post, it is best to add a unique css class to the post_class() which is used in most recent themes; like so: <code>post_class($extra);</code> to add the extra class to post_class.</p>
<p>All combined might look like (based on the code of content.php in Twenty Eleven):</p>
<pre class="brush: php; title: ; notranslate">&lt;article id=&quot;post-&lt;?php the_ID(); ?&gt;&quot; &lt;?php $extra = ( $wp_query-&gt;current_post == 0 &amp;&amp; !is_paged() ) ? 'specialclass' : ''; post_class($extra); ?&gt;&gt;</pre>
<p>If the goal is to have a totally different output for the first post, then a conditional structure is needed (within the loop, wrapping the post output):</p>
<pre class="brush: php; title: ; notranslate">&lt;?php if( $wp_query-&gt;current_post == 0 &amp;&amp; !is_paged() ) : ?&gt;
/*the output of the first post*?
&lt;?php else : ?&gt;
/*the output of all other posts*/
&lt;?php endif; ?&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.transformationpowertools.com/wordpress/styling-first-post-different/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Posts in Columns &#8211; A New Twist on an Old Problem</title>
		<link>http://www.transformationpowertools.com/wordpress/posts-in-columns-a-new-twist-on-an-old-problem</link>
		<comments>http://www.transformationpowertools.com/wordpress/posts-in-columns-a-new-twist-on-an-old-problem#comments</comments>
		<pubDate>Fri, 10 Jun 2011 14:47:15 +0000</pubDate>
		<dc:creator>alchymyth</dc:creator>
				<category><![CDATA[Easy Coding for Wordpress]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[3 column post]]></category>
		<category><![CDATA[columns]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[easy coding]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[grid style]]></category>
		<category><![CDATA[posts in columns]]></category>

		<guid isPermaLink="false">http://www.transformationpowertools.com/wordpress/?p=1254</guid>
		<description><![CDATA[To organize posts into three columns, you first need to generate a column dependant css class for each post; this will be added to the post div within the loop. The core trick to generate different css classes for posts &#8230; <a href="http://www.transformationpowertools.com/wordpress/posts-in-columns-a-new-twist-on-an-old-problem">Check the whole post <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>To organize posts into three columns, you first need to generate a column dependant css class for each post; this will be added to the post div within the loop.</p>
<p>The core trick to generate different css classes for posts in the first coliumn, the second column, and the last column:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php $column = ($column == '') ? 'first' : (($column == 'first') ? 'middle' : (($column == 'middle') ? 'last' : 'first' )); ?&gt;</pre>
<p>This line of code needs to be within the loop, just before the post div.</p>
<p>To achieve more or less the same, you could obviously also use a counter variable and the modulus operator, as i have elaborated on in my earlier article <a href="http://www.transformationpowertools.com/wordpress/zebra-style-wordpress-loop">&#8216;More-Than-Zebra style WordPress loop&#8217;</a>. However, the above method is simpler and easier to apply within a single line of code.</p>
<p>The second step is to add this as a css class to the post div:</p>
<p>a &#8211;  assume a theme without the use of &#8216;post_class()&#8217;; the typical opening div would look like:</p>
<pre class="brush: php; title: ; notranslate">&lt;div class=&quot;post&quot; id=&quot;post-&lt;?php the_ID(); ?&gt;&quot;&gt;</pre>
<p>This is changed into:</p>
<pre class="brush: php; title: ; notranslate">&lt;div class=&quot;post &lt;?php echo $column; ?&gt;&quot; id=&quot;post-&lt;?php the_ID(); ?&gt;&quot;&gt;</pre>
<p>b &#8211; in a theme using the &#8216;post_class()&#8217;, the new code would look like:</p>
<pre class="brush: php; title: ; notranslate">&lt;div &lt;?php post_class($column); ?&gt; id=&quot;post-&lt;?php the_ID(); ?&gt;&quot;&gt;</pre>
<p>Third and last step: to tell the browser what to do with the new css classes, add some styles to style.css of the theme:</p>
<pre class="brush: css; title: ; notranslate">/* .first, .middle, .last styling of posts on home page for three column */
.first, .middle, .last { width: 32%; float:left; clear:none!important; }
.first { margin-right: 2%; clear:both!important; }
.middle { margin-right: 2%; }</pre>
<p>Final details depend on the existing theme.</p>
<p>edit &#038; ps:<br />
if you just want to mark the first post in each row &#8211; for instance to add the &#8216;clear:both;&#8217; and a different margin there &#8211; try to work with:<br />
(example for 5 columns)</p>
<pre class="brush: php; title: ; notranslate">
&lt;div &lt;?php $column = ($wp_query-&gt;current_post%5 == 0) ? 'first' : ''; post_class($column); ?&gt; id=&quot;post-&lt;?php the_ID(); ?&gt;&quot;&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.transformationpowertools.com/wordpress/posts-in-columns-a-new-twist-on-an-old-problem/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>The Death of Mystery Man</title>
		<link>http://www.transformationpowertools.com/wordpress/the-death-of-mystery-man</link>
		<comments>http://www.transformationpowertools.com/wordpress/the-death-of-mystery-man#comments</comments>
		<pubDate>Mon, 11 Apr 2011 10:54:41 +0000</pubDate>
		<dc:creator>alchymyth</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[branding]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[gravatar]]></category>
		<category><![CDATA[mystery man]]></category>

		<guid isPermaLink="false">http://www.transformationpowertools.com/wordpress/?p=1218</guid>
		<description><![CDATA[Are you fed up with the little grey mystery man or his little weird monster brothers and sisters? You know what i mean &#8211; showing up in your comments for all those without a gravatar? Give them the push and &#8230; <a href="http://www.transformationpowertools.com/wordpress/the-death-of-mystery-man">the mystery solved ... <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Are you fed up with the little grey mystery man or his little weird monster brothers and sisters?</p>
<p><img class="aligncenter size-full wp-image-1220" title="the death of mystery man " src="http://www.transformationpowertools.com/wordpress/wp-content/uploads/2011/04/mystery.jpg" alt="" width="500" height="67" />You know what i mean &#8211; showing up in your comments for all those without a gravatar?</p>
<p>Give them the push and create your own design, supporting your own branding.</p>
<p>Here is how it is done:</p>
<pre class="brush: php; title: ; notranslate">add_filter( 'avatar_defaults', 'newgravatar' );
function newgravatar ($avatar_defaults) {
    $myavatar = get_bloginfo('template_directory') . '/images/own-gravatar.jpg';
    $avatar_defaults[$myavatar] = &quot;Own&quot;;
    return $avatar_defaults;
}</pre>
<p>Add the code to functions.php of your theme; get creative with your graphic; upload it into the images folder of your theme (you might need to adjust the code, if your theme images are in a different folder), and activate it as the new default comment avatar.</p>
<p>Life without Mystery Man will never be the same &#8230;</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;">
<div class="threadpost col-7">
<div class="post">
<pre><code>add_filter( &#039;avatar_defaults&#039;, &#039;newgravatar&#039; );
function newgravatar ($avatar_defaults) {
    $myavatar = get_bloginfo(&#039;template_directory&#039;) . &#039;/images/own-gravatar.jpg&#039;;
    $avatar_defaults[$myavatar] = &quot;Own&quot;;
    return $avatar_defaults;
}<!--formatted--></code></pre>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.transformationpowertools.com/wordpress/the-death-of-mystery-man/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Category Archive Navigation</title>
		<link>http://www.transformationpowertools.com/wordpress/category-archive-navigation</link>
		<comments>http://www.transformationpowertools.com/wordpress/category-archive-navigation#comments</comments>
		<pubDate>Sat, 09 Apr 2011 13:44:16 +0000</pubDate>
		<dc:creator>alchymyth</dc:creator>
				<category><![CDATA[Easy Coding for Wordpress]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[archive]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[formatting]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[next/previous]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.transformationpowertools.com/wordpress/?p=1212</guid>
		<description><![CDATA[A simple next/previous category navigation for the category archive; particular useful if you use your categories to organise your blog, for instance your products, or photos&#8230; the above has a commonly used html structure to help with formatting.]]></description>
			<content:encoded><![CDATA[<p>A simple next/previous category navigation for the category archive; particular useful if you use your categories to organise your blog, for instance your products, or photos&#8230;</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
foreach(get_categories() as $all_cat) {  $cat_ids[] = $all_cat-&gt;term_id; }
 $this_cat = get_query_var('cat');
 $this_cat_position = array_search( $this_cat, $cat_ids ); ?&gt;
&lt;div&gt;
&lt;div&gt;
&lt;?php $prev_cat_position = $this_cat_position -1;
 if( $prev_cat_position &gt;=0 ) {
 $prev_cat_id = array_slice( $cat_ids, $prev_cat_position, 1 );
 echo '&lt;a href=&quot;' . get_category_link($prev_cat_id[0]) . '&quot;&gt;&amp;laquo; ' . get_category($prev_cat_id[0])-&gt;name . '&lt;/a&gt;'; } ?&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;?php $next_cat_position = $this_cat_position +1;
 if( $next_cat_position &lt; count($cat_ids) ) {
 $next_cat_id = array_slice( $cat_ids, $next_cat_position, 1 );
echo '&lt;a href=&quot;' . get_category_link($next_cat_id[0]) . '&quot;&gt;' . get_category($next_cat_id[0])-&gt;name . ' &amp;raquo;&lt;/a&gt;'; } ?&gt;
&lt;/div&gt;
&lt;/div&gt;</pre>
<p>the above has a commonly used html structure to help with formatting.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.transformationpowertools.com/wordpress/category-archive-navigation/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adjusting Caption Frame Width</title>
		<link>http://www.transformationpowertools.com/wordpress/adjust-caption-frame-width</link>
		<comments>http://www.transformationpowertools.com/wordpress/adjust-caption-frame-width#comments</comments>
		<pubDate>Wed, 30 Mar 2011 19:27:19 +0000</pubDate>
		<dc:creator>alchymyth</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[contempory]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[frame]]></category>
		<category><![CDATA[image caption]]></category>
		<category><![CDATA[shortcode]]></category>

		<guid isPermaLink="false">http://www.transformationpowertools.com/wordpress/?p=1173</guid>
		<description><![CDATA[WordPress captions come with a fixed frame which is set in the wordpress core file &#8216;media.php&#8217; in the &#8216;wp-includes&#8217; folder. The caption shortcode function adds a 5px wide space to the left and right of the image; and outputs the &#8230; <a href="http://www.transformationpowertools.com/wordpress/adjust-caption-frame-width">Check the whole post <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1177" title="standard_caption" src="http://www.transformationpowertools.com/wordpress/wp-content/uploads/2011/03/standard_caption.jpg" alt="" width="193" height="161" />WordPress captions come with a fixed frame which is set in the wordpress core file &#8216;media.php&#8217; in the &#8216;wp-includes&#8217; folder.</p>
<p>The caption shortcode function adds a 5px wide space to the left and right of the image; and outputs the new calculated width as in an inline style in the attachment div.</p>
<p><img class="alignleft size-full wp-image-1175" style="clear: left;" title="slim_caption" src="http://www.transformationpowertools.com/wordpress/wp-content/uploads/2011/03/slim_caption.jpg" alt="" width="193" height="161" />For WordPress users, a familiar picture which you can only influence within limits by avoiding a background color for the attachment div.</p>
<p>However, if you want to have a slim contempory design <strong>and </strong>a background color behind the caption text, this would simply not work.</p>
<p>You need a fix.</p>
<p>The code below can be added to functions.php of your theme to allow you to set the frame width on your captions (sitewide) to any amount you like.</p>
<p>You need to <strong>adapt a few .wp-caption styles</strong> in style.css of your theme, after you have successfully added the code &#8211; that is all.</p>
<p>There you have your new contempory slim image caption design.</p>
<pre class="brush: php; title: ; notranslate">add_shortcode('wp_caption', 'slim_img_caption_shortcode');
add_shortcode('caption', 'slim_img_caption_shortcode');
function slim_img_caption_shortcode($attr, $content = null) {
 // Allow plugins/themes to override the default caption template.
 $output = apply_filters('img_caption_shortcode', '', $attr, $content);
 if ( $output != '' )
 return $output;

 extract(shortcode_atts(array(
 'id'    =&gt; '',
 'align'    =&gt; 'alignnone',
 'width'    =&gt; '',
 'caption' =&gt; ''
 ), $attr));

 if ( 1 &gt; (int) $width || empty($caption) )
 return $content;

 if ( $id ) $id = 'id=&quot;' . esc_attr($id) . '&quot; ';

 $frame_width = 0; // frame width in pixels per side //

 return '&lt;div ' . $id . 'class=&quot;wp-caption ' . esc_attr($align) . '&quot; style=&quot;width: ' . ( 2 * $frame_width + (int) $width) . 'px&quot;&gt;'
 . do_shortcode( $content ) . '&lt;p class=&quot;wp-caption-text&quot;&gt;' . $caption . '&lt;/p&gt;&lt;/div&gt;';
}</pre>
<p>edit: added the css class .wp-caption-text</p>
<p style="text-align: center;">Another step to total freedom of design &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.transformationpowertools.com/wordpress/adjust-caption-frame-width/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hierarchical Category List with Post Titles</title>
		<link>http://www.transformationpowertools.com/wordpress/hierarchical-category-list-with-post-titles</link>
		<comments>http://www.transformationpowertools.com/wordpress/hierarchical-category-list-with-post-titles#comments</comments>
		<pubDate>Wed, 30 Mar 2011 17:00:10 +0000</pubDate>
		<dc:creator>alchymyth</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[advanced]]></category>
		<category><![CDATA[categories]]></category>
		<category><![CDATA[category list]]></category>
		<category><![CDATA[category posts]]></category>
		<category><![CDATA[Codex]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[hierarchical list]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.transformationpowertools.com/wordpress/?p=1156</guid>
		<description><![CDATA[If your wordpress site is organized with categories, it might be very useful to have a template to show an organized list of all categories with the associated posts. This would work similar to the category widget with the setting &#8230; <a href="http://www.transformationpowertools.com/wordpress/hierarchical-category-list-with-post-titles">Check the whole post <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-medium wp-image-1167" title="category_list" src="http://www.transformationpowertools.com/wordpress/wp-content/uploads/2011/03/category_list-300x115.jpg" alt="" width="300" height="115" />If your wordpress site is organized with categories, it might be very useful to have a template to show an organized list of all categories with the associated posts.</p>
<p>This would work similar to the category widget with the setting &#8216;hierarchical&#8217; &#8211; only that for each category, all the post titles are listed with links to the individual post.</p>
<p>This is the code:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
/*****************************************************************
*
* alchymyth 2011
* a hierarchical list of all categories, with linked post titles
*
******************************************************************/
// http://codex.wordpress.org/Function_Reference/get_categories

 foreach( get_categories('hide_empty=0') as $cat ) :
 if( !$cat-&gt;parent ) {
 echo '&lt;ul&gt;&lt;li&gt;&lt;strong&gt;' . $cat-&gt;name . '&lt;/strong&gt;&lt;/li&gt;';
 process_cat_tree( $cat-&gt;term_id );
 }
 endforeach;

 wp_reset_query(); //to reset all trouble done to the original query
//
function process_cat_tree( $cat ) {

 $args = array('category__in' =&gt; array( $cat ), 'numberposts' =&gt; -1);
 $cat_posts = get_posts( $args );

 if( $cat_posts ) :
 foreach( $cat_posts as $post ) :
 echo '&lt;li&gt;';
 echo '&lt;a href=&quot;' . get_permalink( $post-&gt;ID ) . '&quot;&gt;' . $post-&gt;post_title . '&lt;/a&gt;';
 echo '&lt;/li&gt;';
 endforeach;
 endif;

 $next = get_categories('hide_empty=0&amp;parent=' . $cat);

 if( $next ) :
 foreach( $next as $cat ) :
 echo '&lt;ul&gt;&lt;li&gt;&lt;strong&gt;' . $cat-&gt;name . '&lt;/strong&gt;&lt;/li&gt;';
 process_cat_tree( $cat-&gt;term_id );
 endforeach;
 endif;

 echo '&lt;/ul&gt;';
}
?&gt;
</pre>
<p>The first step is to find all top level categories (generated in alphabetical order) &#8211; which is simply done with the wordpress function &#8216;get_categories()&#8217; and by checking if the category has a parent.<br />
Caveat: because the code is checking for top level categories only, you can&#8217;t directly use the parameters of &#8216;get_categories()&#8217; (see the Codex, the mostly unread documentation of WordPress) without some customization of the top section of the code.</p>
<p>The second step is to show the titles of all available posts for each top level category, linked to the full individual post; done with &#8216;get_posts()&#8217; and &#8216;get_permalink()&#8217;.</p>
<p>The third step is to find possible direct child categories for this (top) category; done with the &#8216;parent&#8217; parameter of &#8216;get_categories()&#8217;.</p>
<p>Then step 2 and 3 are repeated until all possible categories are dealt with.</p>
<p>edit 11/06/2011: parameter corrected.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.transformationpowertools.com/wordpress/hierarchical-category-list-with-post-titles/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Easy Coding for WordPress: Posts in 3 Columns</title>
		<link>http://www.transformationpowertools.com/wordpress/easy-coding-for-wordpress-posts-in-3-columns</link>
		<comments>http://www.transformationpowertools.com/wordpress/easy-coding-for-wordpress-posts-in-3-columns#comments</comments>
		<pubDate>Wed, 23 Mar 2011 14:55:49 +0000</pubDate>
		<dc:creator>alchymyth</dc:creator>
				<category><![CDATA[Easy Coding for Wordpress]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[3 column post]]></category>
		<category><![CDATA[3 columns]]></category>
		<category><![CDATA[dividing the_loop]]></category>
		<category><![CDATA[posts]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.transformationpowertools.com/wordpress/?p=1144</guid>
		<description><![CDATA[Sometimes it is the simple things that are hard to find. A basic structure to arrange posts into three columns: The minimal styles needed for the three columns: &#60;div id=&#8221;column-wrap&#8221;&#62; &#60;?php $count = 0; while(have_posts()) : the_post() ?&#62; &#60;div class=&#8221;box&#60;?php &#8230; <a href="http://www.transformationpowertools.com/wordpress/easy-coding-for-wordpress-posts-in-3-columns">Check the whole post <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sometimes it is the simple things that are hard to find.</p>
<p>A basic structure to arrange posts into three columns:</p>
<pre class="brush: php; title: ; notranslate">&lt;div id=&quot;column-wrap&quot;&gt;
&lt;?php $count = 0;

while(have_posts()) : the_post(); ?&gt;

&lt;div class=&quot;box&lt;?php if( $count%3 == 0 ) { echo '-1'; }; $count++; ?&gt;&quot;&gt;

&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;
&lt;!--and other output of the loop --&gt;

&lt;/div&gt;

&lt;?php endwhile; ?&gt;
&lt;/div&gt;&lt;!--end column-wrap--&gt;</pre>
<p>The minimal styles needed for the three columns:</p>
<pre class="brush: plain; title: ; notranslate">
.box-1 { float:left; clear:left; width: 30%; margin-left: 0; }
.box { float:left; width: 30%; margin-left: 3%; }
</pre>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;">
<ol>
<li class="li1">
<div class="de1">&lt;div id=&#8221;column-wrap&#8221;&gt;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$count</span> <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">while</span><span class="br0">(</span>have_posts<span class="br0">(</span><span class="br0">)</span><span class="br0">)</span> <span class="sy0">:</span> the_post<span class="br0">(</span><span class="br0">)</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy1">?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&lt;div class=&#8221;box<span class="kw2">&lt;?php</span> <span class="kw1">if</span><span class="br0">(</span> <span class="re0">$count</span><span class="sy0">%</span><span class="nu19">3</span> <span class="sy0">==</span> <span class="nu0">0</span> <span class="br0">)</span> <span class="br0">{</span> <span class="kw1">echo</span> <span class="st_h">&#8216;-1&#8242;</span><span class="sy0">;</span> <span class="br0">}</span><span class="sy0">;</span> <span class="re0">$count</span><span class="sy0">++;</span> <span class="sy1">?&gt;</span>&#8220;&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;a href=&#8221;<span class="kw2">&lt;?php</span> the_permalink<span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="sy1">?&gt;</span>&#8220;&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;h4&gt;<span class="kw2">&lt;?php</span> the_title<span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="sy1">?&gt;</span>&lt;/h4&gt;&lt;/a&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;!&#8211;and other output of the loop &#8211;&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;/div&gt;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span> <span class="kw1">endwhile</span><span class="sy0">;</span> <span class="sy1">?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&lt;/div&gt;&lt;!&#8211;end column-wrap&#8211;&gt;</div>
</li>
<li class="li1">
<div class="de1">&#8212;&#8212;&#8212;&#8212;&#8212;-</div>
</li>
<li class="li1 ln-xtra">
<div class="de1">STYLES &#8211; EXAMPLE</div>
</li>
<li class="li1">
<div class="de1">.box-1 { float:left; clear:left; width: 30%; margin-left: 0;  }</div>
</li>
<li class="li1">
<div class="de1">.box { float:left; width: 30%; margin-left: 3%; }</div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.transformationpowertools.com/wordpress/easy-coding-for-wordpress-posts-in-3-columns/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adsense Ad at the More Tag Position</title>
		<link>http://www.transformationpowertools.com/wordpress/adsense-ad-at-more-tag-fold</link>
		<comments>http://www.transformationpowertools.com/wordpress/adsense-ad-at-more-tag-fold#comments</comments>
		<pubDate>Sun, 06 Feb 2011 17:54:11 +0000</pubDate>
		<dc:creator>alchymyth</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[adsense]]></category>
		<category><![CDATA[continue reading]]></category>
		<category><![CDATA[filter function]]></category>
		<category><![CDATA[more tag]]></category>
		<category><![CDATA[single post]]></category>

		<guid isPermaLink="false">http://www.transformationpowertools.com/wordpress/?p=1120</guid>
		<description><![CDATA[Surprise your readers with a google ad after clicking the &#8216;read more&#8217; link &#8211; a strategic position to catch the attention of the viewer and increase your revenue. Advertising does not get the same attention all over your page, as &#8230; <a href="http://www.transformationpowertools.com/wordpress/adsense-ad-at-more-tag-fold">Check the whole post <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Surprise your readers with a google ad after clicking the &#8216;read more&#8217; link &#8211; a strategic position to catch the attention of the viewer and increase your revenue.</p>
<p>Advertising does not get the same attention all over your page, as <a href="https://www.google.com/adsense/support/bin/answer.py?hl=en&amp;answer=17954">this report</a> shows, some areas are &#8216;hotter&#8217; than others, and the top of your content is one of the &#8216;hottest&#8217;.</p>
<p>Many of you insert the &#8216;more-tag&#8217; after a short introductionary part of your content when writing your articles &#8211; usually to keep the design of the home page clean and easy to navigate.</p>
<p>When  the reader clicks on the &#8216;continue reading&#8217; button, this already proves that the article has so far captured his attention &#8211; and the reader is more likely to follow any targeted advertising links, particular if these are seamlessly integrated into the main post content.</p>
<p><span id="more-1120"></span></p>
<p>And the &#8216;more link&#8217; will jump right into the position where the text on the home page ended.</p>
<p>It is your task to create the adsense so that the colors and design of the ads match the design of your post page.</p>
<p>The technical part: add this code into the template file functions.php of your wordpress theme; and replace the adsense code with your own:</p>
<pre class="brush: php; title: ; notranslate">add_filter('the_content', 'adsense_added_at_more_tag');
function adsense_added_at_more_tag($text) {
if( is_single() ) :
$ads_text = '&lt;span&gt;
&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
google_ad_client = &quot;pub-0123412341234123&quot;;
/* personal_development */
google_ad_slot = &quot;1234512345&quot;;
google_ad_width = 468;
google_ad_height = 60;
//--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;
&lt;/script&gt;
&lt;/span&gt;';
$pos1 = strpos($text, '&lt;span id=&quot;more-');
$pos2 = strpos($text, '&lt;/span&gt;', $pos1);
$text1 = substr($text, 0, $pos2);
$text2 = substr($text, $pos2);
$text = $text1 . $ads_text . $text2;
endif;
return $text;
}</pre>
<p>You can then add some styling such as alignment by using the css class .adsense in style.css of your theme:</p>
<pre class="brush: plain; title: ; notranslate">.adsense {
display:block;
width:100%;
text-align: center;
background: #f8f8f8;
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.transformationpowertools.com/wordpress/adsense-ad-at-more-tag-fold/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Custom ‘Read More’ text per Post for Twenty Ten</title>
		<link>http://www.transformationpowertools.com/wordpress/custom-read-more-text-per-post-for-twenty-ten</link>
		<comments>http://www.transformationpowertools.com/wordpress/custom-read-more-text-per-post-for-twenty-ten#comments</comments>
		<pubDate>Tue, 28 Dec 2010 21:33:53 +0000</pubDate>
		<dc:creator>alchymyth</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[custom fields]]></category>
		<category><![CDATA[customisation]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[read more]]></category>
		<category><![CDATA[TwentyTen]]></category>

		<guid isPermaLink="false">http://www.transformationpowertools.com/wordpress/?p=1099</guid>
		<description><![CDATA[A sophisticated way to get a custom written &#8216;read more&#8217; text added to your posts in the theme Twenty Ten (or its child themes). The code builds on this article I posted earlier. It uses the custom field with the &#8230; <a href="http://www.transformationpowertools.com/wordpress/custom-read-more-text-per-post-for-twenty-ten">Check the whole post <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A sophisticated way to get a custom written &#8216;read more&#8217; text added to your posts in the theme Twenty Ten (or its child themes).</p>
<p>The code builds on <a href="http://www.transformationpowertools.com/wordpress/read-more-in-twenty-ten-child-theme">this article</a> I posted earlier.</p>
<p>It uses the custom field with the key &#8216;cont_read&#8217; to hold the custom text.</p>
<p>Add this code to functions.php of the theme:</p>
<pre class="brush: php; title: ; notranslate">/* Twenty Ten custom 'continue reading'
/
/ custom field ($key = 'cont_read' ) dependant 'continue reading' text
/ alchymyth 2010
*/
class Transformation_Text_Wrangler {
function reading_more($translation, $text, $domain) {

global $post;
 $cont_read = get_post_meta( $post-&gt;ID, 'cont_read', true );
 if( $cont_read ) :
 $cont_read = htmlentities($cont_read, ENT_QUOTES);
 $translations = &amp;get_translations_for_domain( $domain );
 if ( $text == 'Continue reading &lt;span&gt;&amp;rarr;&lt;/span&gt;' ) {
 return $translations-&gt;translate( $cont_read . ' &lt;span&gt;&amp;raquo;&lt;/span&gt;' );
 }
 return $translation; // custom field value
 else :
 return $translation; // standard text
 endif;
 }
}
add_filter('gettext', array('Transformation_Text_Wrangler', 'reading_more'), 10, 4);</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.transformationpowertools.com/wordpress/custom-read-more-text-per-post-for-twenty-ten/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

