WordPress.org

Support

Support » How-To and Troubleshooting » Hide Post Count

Hide Post Count

  • Hi,

    I am using the K2 theme, with the Sidebar modules plugin. My categories are listed in the side bar with the number of posts in each category in brackets after the category title. Would anyone have any idea how i can remove the brackets and the number of posts – i just want the category titles. Have looked on the K2 forum but can not find a solution……….

    Thanks in advance for any help!

    Andy

Viewing 13 replies - 1 through 13 (of 13 total)
  • The Category List sidebar module in K2 uses the template tag “wp_list_categories” and the code for it is located in sidebar.php in the root of the K2 folder. If you open the file and find the code “wp_list_categories(‘title_li=&show_count=1&hierarchical=0’);” remove “&show_count=1” from that and it should display how you want it to.

    For a full list of arguments for “wp_list_categories” see http://codex.wordpress.org/Template_Tags/wp_list_categories

    HI,

    Sorry i tried that and it didnt work – i should have mentioned that i am using the category access plugin……http://www.coppit.org/code/

    Anyideas what might be causing them to keep showing?

    Cheers

    Andy

    I have had a look at the code and even edited it on my website and it does not stop the count showing for me as well. This is the block of code that controls that sidebar widget;

    <?php
    			if (function_exists('wp_list_categories')) {
    				wp_list_categories('title_li=&show_count=1&hierarchical=0');
    			} else {
    				list_cats(0, '', 'name', 'asc', '', 1, 0, 1, 1, 1, 1, 0,'','','','','');
    			}
    			?>

    if you look at the list of numbers 1, 0, 1, 1, 1, 1, 0, the third number 1 in is the optioncount parameter of the list_cats tag. I also tried setting that to 0 but no luck.

    I shall have a look around and try and find out the problem for you.

    Hi, I got an answer for you. Open up categories.php under /app/modules/ inside your K2 folder and edit the lines

    wp_list_categories('title_li=&show_count=1&hierarchical=0');

    and

    list_cats(0, '', 'name', 'asc', '', 1, 0, 1, 1, 1, 1, 0,'','','','','');

    to

    wp_list_categories('title_li=&show_count=0&hierarchical=0

    and

    list_cats(0, '', 'name', 'asc', '', 1, 0, 0, 1, 1, 1, 0,'','','','','');

    Thanks to Zeo at the K2 forums.

    Hey there,

    I opened that file, and that code is not contained in it – here is the only code in that file:

    <?php

    function categories_sidebar_module($args) {
    extract($args);

    echo($before_module . $before_title . $title . $after_title);
    ?>

      <?php
      if (function_exists(‘wp_list_categories’))
      ?>

    <?php
    echo($after_module);
    }

    register_sidebar_module(‘Category list module’, ‘categories_sidebar_module’, ‘sb-categories’);

    ?>

    Perhaps the category access plugin i mentioned above is causing the problem – there are a few php files with options in the plugin……..?

    Cheers

    Andy

    Seems like this is a question for those who know more about K2. What version of K2 and WP do you have?

    Hi There,

    Its Worpdress 2.1 and K2 version and K2 0.95 RC1 by Various Artists.

    Hope this helps solve the mystery!

    Cheers

    Andy

    I modified app/modules/categories.php to say this:
    wp_list_categories(‘title_li=&show_count=0&hierarchical=0’);

    and it removed the count for WP 2.1. Neither my Category Order or Category Access plugins have anything to do with it.

    Hi,

    Thanks for posting! I am new to PHP, can you cut and paste the exact code i should have in the whole file, like i have above – i am not good at modifying as i don’t know what to leave out and what to leave in!!

    Bottle of Whiskey has been purchased……… 🙂

    Andy

    I have tried all variations of modifying, using the above posts as a guide – and they are still showing up……. 🙁

    Andy

    Hi again,

    I have sidebar modules installed – could this be causing a conflict?

    Andy

    Guys – i have it sussed! It was the sidebar module that was causing the problem! I applied what you told me to apply to the sidebar module catagory.php file and it worked!

    Thansk so much for all your help with this……… I really really appreciate it!

    Andy

    Hi, i have same issues here…how do i hide the post counts just after post categories in my blog? actually display in brackets. Tried everything but, seems doesn’t solve it.

    here comes the code:

    <div class="block">
    		<div class="menu">
    			<ul class="slightbigger">
    				<?php list_cats(FALSE, '', 'name',
                    				'asc', '', TRUE, FALSE,
                    				TRUE, FALSE, FALSE,
                    				TRUE, FALSE, '', FALSE,
                    				'', '', '1',
                    				TRUE); ?>
    			</ul>
    		</div>
    	</div>

    For info, I’m using AdsMinded theme from SapiensBryan.
    Thanks for any help!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Hide Post Count’ is closed to new replies.