Add item count to menu display

Forums Forums Menus Add item count to menu display

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #629
    jules
    Member

    Hi, I was wondering if someone could tell me where I can add the code to make the menu display the post count under categories and archives, such as show_count=1.

    Thanks!

    #5307

    No idea off the top of my head. But I’m about to new update tonight so I’ll see if I can add that functionality into the core for you.

    I need a break from other web work anyway as it is driving me INSANE!

    #5308

    Darn it. show_count=1 is added to outside of the link. This messes up the styling from the CSS generator. I don’t want to include features which won’t look right with the CSS from the generator so I won’t be including this feature by default, or at least not until I have a new CSS generator up and running properly.

    The following script will be commented out in the next release. It adds an extra option in the admin panel for showing the post counts:
    [code:3954bdum] <p><?php _e(‘The number of posts in each category may be displayed alongside the category name.’,’pixopoint_mln’); ?></p>
      <div class="includeexclude">
    <p style="margin-top:10px">
    <label><?php _e(‘Show post counts’,’pixopoint_mln’); ?></label>
    </p>
    <?php
    if (get_option(‘suckerfish_categorycount’) == ‘on’) {echo ‘<input type="checkbox" name="suckerfish_categorycount" checked="yes" />’;}
    else {echo ‘<input type="checkbox" name="suckerfish_categorycount" />’;}
    ?>
    </div>[/code:3954bdum]

    And here is a new script which will be added into the core. It won’t be commented out, but it also won’t do anything unless you add the admin code above:
    [code:3954bdum]
    function category() {
    if (get_option(‘suckerfish_categorycount’) == ‘on’) {$suckerfish_categorycount = ‘show_count=1’;}
    $suckerfish_depthcategories = get_option(‘suckerfish_depthcategories’);switch ($suckerfish_depthcategories){case "Top level only":$suckerfish_depthcategoriesecho = ‘&depth=1’;break;case "No nesting":$suckerfish_depthcategoriesecho = ‘&depth=-1’;break;case "1 level of children":$suckerfish_depthcategoriesecho = ‘&depth=2’;break;case "2 levels of children":$suckerfish_depthcategoriesecho = ‘&depth=3’;break;case "Infinite":$suckerfish_depthcategoriesecho = ‘&depth=0’;break;case "":$suckerfish_depthcategoriesecho = ‘&depth=0’;break;}
    $suckerfish_categoryorder=get_option(‘suckerfish_categoryorder’);switch ($suckerfish_categoryorder){case "Ascending ID #":$suckerfish_categoryorderecho = ‘&orderby=id&order=ASC’;break;case "Decending ID #":$suckerfish_categoryorderecho = ‘&orderby=id&order=DESC’;break;case "Ascending Name":$suckerfish_categoryorderecho = ‘&orderby=name&order=ASC’;break;case "Decending Name":$suckerfish_categoryorderecho = ‘&orderby=name&order=DESC’;break;case "":$suckerfish_categoryorderecho = ‘&orderby=name&order=DESC’;break;}
    wp_list_categories(‘title_li=&’.$suckerfish_categorycount.’&’.get_option(‘suckerfish_includeexcludecategories’).’=’.get_option(‘suckerfish_excludecategories’).$suckerfish_depthcategoriesecho);
    }
    function categoriesdropdown() {
    if (get_option(‘suckerfish_categorycount’) == ‘on’) {$suckerfish_categorycount = ‘show_count=1’;}
    $suckerfish_depthcategories = get_option(‘suckerfish_depthcategories’);switch ($suckerfish_depthcategories){case "Top level only":$suckerfish_depthcategoriesecho = ‘&depth=1’;break;case "No nesting":$suckerfish_depthcategoriesecho = ‘&depth=-1’;break;case "1 level of children":$suckerfish_depthcategoriesecho = ‘&depth=2’;break;case "2 levels of children":$suckerfish_depthcategoriesecho = ‘&depth=3’;break;case "Infinite":$suckerfish_depthcategoriesecho = ‘&depth=0’;break;case "":$suckerfish_depthcategoriesecho = ‘&depth=0’;break;}
    $suckerfish_categoryorder=get_option(‘suckerfish_categoryorder’);switch ($suckerfish_categoryorder){case "Ascending ID #":$suckerfish_categoryorderecho = ‘&orderby=id&order=ASC’;break;case "Decending ID #":$suckerfish_categoryorderecho = ‘&orderby=id&order=DESC’;break;case "Ascending Name":$suckerfish_categoryorderecho = ‘&orderby=name&order=ASC’;break;case "Decending Name":$suckerfish_categoryorderecho = ‘&orderby=name&order=DESC’;break;case "":$suckerfish_categoryorderecho = ‘&orderby=name&order=DESC’;break;}
    if (is_category()) {$suckerfish_class=’ class="current_page_parent current_page_item"’;} echo ‘<li’.$suckerfish_class.’><a href="’; if (get_option(‘suckerfish_categoriesurl’) != ”) {echo get_option(‘suckerfish_categoriesurl’);} echo ‘">’ . get_option(‘suckerfish_categoriestitle’) . ‘</a><ul>’ , implode("</a>n<ul",explode("</a>n<ul",str_replace("t",”,wp_list_categories(‘title_li=&’.$suckerfish_categorycount.’&’.get_option(‘suckerfish_includeexcludecategories’).’=’. get_option(‘suckerfish_excludecategories’).’&echo=0’.$suckerfish_categoryorderecho.$suckerfish_depthcategoriesecho)))) , "</ul></li>n";
    }[/code:3954bdum]

    The only other solution would be to write a custom script directly into your theme. But then you aren’t really using the plugin at all if you do that <img decoding=” title=”Sad” />

    #5309
    jules
    Member

    Thanks Ryan for the suggestion. I have tried it and I have to say I couldn’t get it to work. Probably just me. Either way I don’t feel it is something I want to do that way as it will require rediting the code at every upgrade.

    Could you hard code the option into the admin interface for a future release?

    Also I have different themes with different menus, is it possible to add the css to my themes and the plugin reads from that, otherwise evertime I change theme or if I had a theme switcher and the user changed theme the menu is still styled from the css I pasted into the admin appearance box.

    Thanks!

    #5310

    As I said in the post above, this was going to be added to the next release which was a few days ago. It is now an option in the admin page.

    There is already an option in the plugin which allows you to disable the built in style sheet. It’s near the bottom of the settings section of the admin page.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.