Wordpress Ninjas help please: Display categories in columns with post count

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tonyparra
    Confirmed User
    • Jul 2008
    • 4568

    #1

    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>

    High Performance Vps $10 Linode
    Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot
  • fris
    Too lazy to set a custom title
    • Aug 2002
    • 55679

    #2
    wp_list_categories has the option of showing the count

    show_count=1
    Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

    Comment

    • femdomdestiny
      Confirmed User
      • Apr 2007
      • 5183

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


      --------------------------------------------
      ICQ: 463-630-426
      email: webmaster(at)femdomdestiny.com

      Comment

      • tonyparra
        Confirmed User
        • Jul 2008
        • 4568

        #4
        Originally posted by femdomdestiny
        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

        High Performance Vps $10 Linode
        Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot

        Comment

        • tonyparra
          Confirmed User
          • Jul 2008
          • 4568

          #5
          Originally posted by fris
          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

          High Performance Vps $10 Linode
          Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot

          Comment

          Working...