<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	>
<channel>
	<title>Comments on: Fun with Wordpress categories</title>
	<atom:link href="http://tugbucket.net/wordpress/fun-with-wordpress-categories/feed/" rel="self" type="application/rss+xml" />
	<link>http://tugbucket.net/wordpress/fun-with-wordpress-categories/</link>
	<description></description>
	<pubDate>Thu, 09 Sep 2010 16:00:09 +0000</pubDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Lillier</title>
		<link>http://tugbucket.net/wordpress/fun-with-wordpress-categories/comment-page-1/#comment-245</link>
		<dc:creator>Lillier</dc:creator>
		<pubDate>Fri, 02 Jul 2010 11:28:12 +0000</pubDate>
		<guid isPermaLink="false">http://tugbucket.net/?p=118#comment-245</guid>
		<description>Hello, i'm looking for help! 

my website having problem with the display of posts under each categories.
Normally if you access any one of my categories (from sidebar or other place), you should see all posts listed.

But now it only show maybe 1 post or 2 post (1 full posts and 1 only the title being show).
i've try to deactivate all plugin to see if it works, but it still doesn't work.
But when i switch it to another theme then it's working fine.

i've another website can run the theme without the problem i mention...

Can you help me to settle this issue? Thank you......</description>
		<content:encoded><![CDATA[<p>Hello, i&#8217;m looking for help! </p>
<p>my website having problem with the display of posts under each categories.<br />
Normally if you access any one of my categories (from sidebar or other place), you should see all posts listed.</p>
<p>But now it only show maybe 1 post or 2 post (1 full posts and 1 only the title being show).<br />
i&#8217;ve try to deactivate all plugin to see if it works, but it still doesn&#8217;t work.<br />
But when i switch it to another theme then it&#8217;s working fine.</p>
<p>i&#8217;ve another website can run the theme without the problem i mention&#8230;</p>
<p>Can you help me to settle this issue? Thank you&#8230;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Holger</title>
		<link>http://tugbucket.net/wordpress/fun-with-wordpress-categories/comment-page-1/#comment-225</link>
		<dc:creator>Holger</dc:creator>
		<pubDate>Wed, 17 Mar 2010 09:59:36 +0000</pubDate>
		<guid isPermaLink="false">http://tugbucket.net/?p=118#comment-225</guid>
		<description>Thanks, that's exactly what I was searching for :)
I did not get it thats its much easierer, if you use the functions.php ..
hope i'll remember that :)</description>
		<content:encoded><![CDATA[<p>Thanks, that&#8217;s exactly what I was searching for <img src='http://tugbucket.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
I did not get it thats its much easierer, if you use the functions.php ..<br />
hope i&#8217;ll remember that <img src='http://tugbucket.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan</title>
		<link>http://tugbucket.net/wordpress/fun-with-wordpress-categories/comment-page-1/#comment-206</link>
		<dc:creator>Alan</dc:creator>
		<pubDate>Thu, 04 Mar 2010 21:06:03 +0000</pubDate>
		<guid isPermaLink="false">http://tugbucket.net/?p=118#comment-206</guid>
		<description>@Virendar

You should be able to modify the function like so.

&lt;code&gt;function desc_cats(){
foreach (get_categories(array('hide_empty'=&gt;true)) as $category)
{
$catid = $category-&gt;cat_ID;
echo '&lt;div&gt;&lt;h3&gt;&lt;a href="' . get_bloginfo('wpurl') . '/category/' .  $category-&gt;category_nicename . '/"&gt;' .
	$category-&gt;cat_name . ' (' . $category-&gt;count.$numposts.')&lt;/a&gt;&lt;/h3&gt;' . category_description($catid) . '&lt;hr&gt;&lt;/div&gt;' . "\n";
}
};
&lt;!--formatted--&gt;&lt;/code&gt;

And call it like so:
&lt;code&gt;&lt;?php desc_cats(); ?&gt;&lt;!--formatted--&gt;&lt;/code&gt;

That will make each category in it's own div with a &lt;h3&gt; and a link for the title and ending with a horizontal rule.

As for paginating the results, not sure off hand. That really has nothign to do with the base of this function.</description>
		<content:encoded><![CDATA[<p>@Virendar</p>
<p>You should be able to modify the function like so.</p>
<p><code>function desc_cats(){<br />
foreach (get_categories(array('hide_empty'=>true)) as $category)<br />
{<br />
$catid = $category->cat_ID;<br />
echo '&lt;div>&lt;h3>&lt;a href="' . get_bloginfo('wpurl') . '/category/' .  $category->category_nicename . '/">' .<br />
	$category->cat_name . ' (' . $category->count.$numposts.')&lt;/a>&lt;/h3>' . category_description($catid) . '&lt;hr>&lt;/div>' . "\n";<br />
}<br />
};<br />
<!--formatted--></code></p>
<p>And call it like so:<br />
<code>&lt;?php desc_cats(); ?><!--formatted--></code></p>
<p>That will make each category in it&#8217;s own div with a &lt;h3> and a link for the title and ending with a horizontal rule.</p>
<p>As for paginating the results, not sure off hand. That really has nothign to do with the base of this function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Virendar</title>
		<link>http://tugbucket.net/wordpress/fun-with-wordpress-categories/comment-page-1/#comment-204</link>
		<dc:creator>Virendar</dc:creator>
		<pubDate>Tue, 23 Feb 2010 15:25:05 +0000</pubDate>
		<guid isPermaLink="false">http://tugbucket.net/?p=118#comment-204</guid>
		<description>ah for number 2 my html isnt shown.  I said I want to add an  "hr'  tag &gt;&lt; in between</description>
		<content:encoded><![CDATA[<p>ah for number 2 my html isnt shown.  I said I want to add an  &#8220;hr&#8217;  tag &gt;&lt; in between</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Virendar</title>
		<link>http://tugbucket.net/wordpress/fun-with-wordpress-categories/comment-page-1/#comment-203</link>
		<dc:creator>Virendar</dc:creator>
		<pubDate>Tue, 23 Feb 2010 15:23:42 +0000</pubDate>
		<guid isPermaLink="false">http://tugbucket.net/?p=118#comment-203</guid>
		<description>Hey ! For the second code, the one with the descriptions, how can I do the following :

1) I want to add pagination. I have over 500 categories, and if all of them are listed WITH their descriptions, its a looooong and laggy page. So maybe only like..50 per page.

2) I want to add an  in between the listed categories to space them out a little and make it look nice.</description>
		<content:encoded><![CDATA[<p>Hey ! For the second code, the one with the descriptions, how can I do the following :</p>
<p>1) I want to add pagination. I have over 500 categories, and if all of them are listed WITH their descriptions, its a looooong and laggy page. So maybe only like..50 per page.</p>
<p>2) I want to add an  in between the listed categories to space them out a little and make it look nice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan</title>
		<link>http://tugbucket.net/wordpress/fun-with-wordpress-categories/comment-page-1/#comment-108</link>
		<dc:creator>Alan</dc:creator>
		<pubDate>Fri, 14 Aug 2009 14:47:52 +0000</pubDate>
		<guid isPermaLink="false">http://tugbucket.net/?p=118#comment-108</guid>
		<description>@zbrass,

I totally see what you mean. I think that would be best left for a manual setting like you are doing. My home page has a hack to only show 4 posts. My archive is using pagination set to 6 posts. So I would think it would be easier to set the category script to the max number you are showing and just send the link to page 2.

Since there is only a few areas that need modification, it's not too difficult.

Glad it worked for you.</description>
		<content:encoded><![CDATA[<p>@zbrass,</p>
<p>I totally see what you mean. I think that would be best left for a manual setting like you are doing. My home page has a hack to only show 4 posts. My archive is using pagination set to 6 posts. So I would think it would be easier to set the category script to the max number you are showing and just send the link to page 2.</p>
<p>Since there is only a few areas that need modification, it&#8217;s not too difficult.</p>
<p>Glad it worked for you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zbrass</title>
		<link>http://tugbucket.net/wordpress/fun-with-wordpress-categories/comment-page-1/#comment-107</link>
		<dc:creator>zbrass</dc:creator>
		<pubDate>Thu, 13 Aug 2009 23:53:08 +0000</pubDate>
		<guid isPermaLink="false">http://tugbucket.net/?p=118#comment-107</guid>
		<description>Great Alan!
Thanks a lot.

But one thing to make it perfect would be that the link 'view more' would give an archive page that starts with post nr6 

I do that now like this

echo '&lt;a&gt;category_nicename . '/page/2/"&gt;View more&lt;/a&gt;' . "\n";

But if you have in your settings 10 posts on a page you have a problem there. You lose flexebility. cause page 2 would start with post 11.

You see what i mean? 

Again thanks a lot!</description>
		<content:encoded><![CDATA[<p>Great Alan!<br />
Thanks a lot.</p>
<p>But one thing to make it perfect would be that the link &#8216;view more&#8217; would give an archive page that starts with post nr6 </p>
<p>I do that now like this</p>
<p>echo &#8216;<a>category_nicename . &#8216;/page/2/&#8221;&gt;View more</a>&#8216; . &#8220;\n&#8221;;</p>
<p>But if you have in your settings 10 posts on a page you have a problem there. You lose flexebility. cause page 2 would start with post 11.</p>
<p>You see what i mean? </p>
<p>Again thanks a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan</title>
		<link>http://tugbucket.net/wordpress/fun-with-wordpress-categories/comment-page-1/#comment-106</link>
		<dc:creator>Alan</dc:creator>
		<pubDate>Thu, 13 Aug 2009 22:51:45 +0000</pubDate>
		<guid isPermaLink="false">http://tugbucket.net/?p=118#comment-106</guid>
		<description>@zbrass,
Thanks for bringing that to my attention. If you read my note above, I have modified the script a little. the 'numberposts' defaults at 5 so that's why it was stopping. I edited it to solve that issue.

Now to your real question.

&lt;code&gt;
function cat_and_posts(){
foreach (get_categories(array('hide_empty'=&gt;true)) as $category)
{
$catid = $category-&gt;cat_ID;
global $post;
$myposts = get_posts('numberposts=100&amp;category='.$catid);
echo '&lt;li&gt;' . $category-&gt;cat_name . "\n";
echo '&lt;ul&gt;' . "\n";
$count = 0;
foreach($myposts as $post) {
echo '&lt;li&gt;&lt;a href="' . get_permalink() . '"&gt;' . get_the_title() . '&lt;/a&gt;&lt;/li&gt;' . "\n";
$count++;
if ($count &gt;= 5){
echo '&lt;li&gt;&lt;a href="' . get_bloginfo('wpurl') . '/category/' .  $category-&gt;category_nicename . '/"&gt;View more&lt;/a&gt;&lt;/li&gt;' . "\n";
break;
}
}
echo '&lt;/ul&gt;' . "\n";
echo '&lt;/li&gt;' . "\n";
}
};   
&lt;!--formatted--&gt;&lt;/code&gt;

We're going to start a count of the posts. Once it reaches 5 it will add a link to the archives for that category and stop the script. 

Now this will not make a link for categories with less than 5 posts. 

Hope that works for you.


@submarine,

That looks like an interesting plug-in. I might play with it soon.</description>
		<content:encoded><![CDATA[<p>@zbrass,<br />
Thanks for bringing that to my attention. If you read my note above, I have modified the script a little. the &#8216;numberposts&#8217; defaults at 5 so that&#8217;s why it was stopping. I edited it to solve that issue.</p>
<p>Now to your real question.</p>
<p><code><br />
function cat_and_posts(){<br />
foreach (get_categories(array('hide_empty'=>true)) as $category)<br />
{<br />
$catid = $category->cat_ID;<br />
global $post;<br />
$myposts = get_posts('numberposts=100&#038;category='.$catid);<br />
echo '&lt;li>' . $category->cat_name . "\n";<br />
echo '&lt;ul>' . "\n";<br />
$count = 0;<br />
foreach($myposts as $post) {<br />
echo '&lt;li>&lt;a href="' . get_permalink() . '">' . get_the_title() . '&lt;/a>&lt;/li>' . "\n";<br />
$count++;<br />
if ($count >= 5){<br />
echo '&lt;li>&lt;a href="' . get_bloginfo('wpurl') . '/category/' .  $category->category_nicename . '/">View more&lt;/a>&lt;/li>' . "\n";<br />
break;<br />
}<br />
}<br />
echo '&lt;/ul>' . "\n";<br />
echo '&lt;/li>' . "\n";<br />
}<br />
};<br />
<!--formatted--></code></p>
<p>We&#8217;re going to start a count of the posts. Once it reaches 5 it will add a link to the archives for that category and stop the script. </p>
<p>Now this will not make a link for categories with less than 5 posts. </p>
<p>Hope that works for you.</p>
<p>@submarine,</p>
<p>That looks like an interesting plug-in. I might play with it soon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Submarine</title>
		<link>http://tugbucket.net/wordpress/fun-with-wordpress-categories/comment-page-1/#comment-105</link>
		<dc:creator>Submarine</dc:creator>
		<pubDate>Thu, 13 Aug 2009 21:25:56 +0000</pubDate>
		<guid isPermaLink="false">http://tugbucket.net/?p=118#comment-105</guid>
		<description>You could also use the Category Icons plugin in order to display icons assigned to categories : use get_cat_icon("echo=false&amp;cat=".$catid); to display the icons in your foreach loop.</description>
		<content:encoded><![CDATA[<p>You could also use the Category Icons plugin in order to display icons assigned to categories : use get_cat_icon(&#8221;echo=false&amp;cat=&#8221;.$catid); to display the icons in your foreach loop.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zbrass</title>
		<link>http://tugbucket.net/wordpress/fun-with-wordpress-categories/comment-page-1/#comment-104</link>
		<dc:creator>zbrass</dc:creator>
		<pubDate>Tue, 11 Aug 2009 14:06:21 +0000</pubDate>
		<guid isPermaLink="false">http://tugbucket.net/?p=118#comment-104</guid>
		<description>Hi,
Thanks for this!

I have a question for now your code shows only 5 post within the cat.
if there are more posts in the cat how can i ad a link to these posts?

I don't want to show more post but find out if there are more than '5' posts and if so a link to the archive page.

foreach($myposts as $post) {
echo '&lt;a href="' . get_permalink() . '" rel="nofollow"&gt;' . get_the_title() . '&lt;/a&gt;' . "\n";
}
 ----HERE THE if more than 5 echo and than a link to the previous posts 
echo '' . "\n";
echo '' . "\n";

I hope you can solve this , i looked everywhere for a solution.

Thanks!</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Thanks for this!</p>
<p>I have a question for now your code shows only 5 post within the cat.<br />
if there are more posts in the cat how can i ad a link to these posts?</p>
<p>I don&#8217;t want to show more post but find out if there are more than &#8216;5&#8242; posts and if so a link to the archive page.</p>
<p>foreach($myposts as $post) {<br />
echo &#8216;<a href="' . get_permalink() . '" rel="nofollow">&#8216; . get_the_title() . &#8216;</a>&#8216; . &#8220;\n&#8221;;<br />
}<br />
 &#8212;-HERE THE if more than 5 echo and than a link to the previous posts<br />
echo &#8221; . &#8220;\n&#8221;;<br />
echo &#8221; . &#8220;\n&#8221;;</p>
<p>I hope you can solve this , i looked everywhere for a solution.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
