GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Wordpress Ninjas help please: Display categories in columns with post count (https://gfy.com/showthread.php?t=1058841)

tonyparra 02-24-2012 11:03 AM

Wordpress Ninjas help please: Display categories in columns with post count
 
Trying to do something like at tubegalore.com where they show show a list of categories, in columns, with the number of videos per category but in wordpress obviously it would be post per category.

I found some php that will display 3 columns but im trying to find a better way

Code:

<?php                                                       
        $catArray = explode("</li>",wp_list_categories('title_li=&echo=0&depth=1'));
        $catCount = count($catArray) - 1;
        $catColumns = round($catCount / 3);
        $twoColumns = round($catColumns + $catColumns);
 
        for ($i=0;$i<$catCount;$i++) {
                if ($i<$catColumns){
                        $catLeft = $catLeft.''.$catArray[$i].'</li>';
                }
                elseif ($i<$twoColumns) {
                        $catMiddle = $catMiddle.''.$catArray[$i].'</li>';
                }
                elseif ($i>=$catColumns){
                        $catRight = $catRight.''.$catArray[$i].'</li>';
                } 
        };
?>
 
<ul class="left">
      <?php echo $catLeft; ?>
</ul>
<ul class="middle">
        <?php echo $catMiddle; ?>
</ul>
<ul class="right">
      <?php echo $catRight; ?>
</ul>


fris 02-24-2012 11:11 AM

wp_list_categories has the option of showing the count

show_count=1

femdomdestiny 02-24-2012 11:20 AM

Isn't that default option? You just need to enable it in sidebar widget.

tonyparra 02-24-2012 11:23 AM

Quote:

Originally Posted by femdomdestiny (Post 18779131)
Isn't that default option? You just need to enable it in sidebar widget.

Yes this isnt going in the sidebar i go 200 categories with thousands of post ...of course i didnt write it lol

tonyparra 02-24-2012 11:25 AM

Quote:

Originally Posted by fris (Post 18779115)
wp_list_categories has the option of showing the count

show_count=1

Aww shit man right in front my face i need another energy drink been up for a day thanks :thumbsup:thumbsup


All times are GMT -7. The time now is 01:58 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc