(0) next to categories in popular post category widget?

This topic contains 11 replies, has 4 voices, and was last updated by  Paolo 9 years, 10 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #10097

    dnosker
    Buyer
    Post count: 68

    What is the (0) next to categories in popular post category widget?

    Is there a way to get rid of the (0) ?

    Thanks!

    #10098

    Simone
    Expired Member
    Post count: 3515

    Hello, the 0 is the number of places in the given category (in your case, 0).

    As far as I know it can be removed, unless it’s edited via code.

    S.

    #10099

    dnosker
    Buyer
    Post count: 68

    It’s not working then… No matter how many places I have in a category it always shows (0). I can click on the category and it will list all the places that are in that category only but still shows the number as 0.

    Where is the code for this widget? I will have to manually remove that from the code. Even if it was showing the correct number I would not want that displayed.

    Thanks

    #10104

    Guust
    Moderator
    Post count: 29970

    And are their listings for that category in the Location you have browsed to?
    If there are no listings at all in category (anywhere), then the category should not even be shown.

    #10133

    dnosker
    Buyer
    Post count: 68

    The categories have multiple listings in each one. Only categories that have listings are being shown but in all cases there is a (0) next each one.
    Not sure why this started. I have not added any plugins before this started showing (0).

    Does anyone know where the exact code is that displays this (0) ? I would like to just get rid of it as I don’t want any counts next to the categories anyways.

    Thanks.

    #10134

    Guust
    Moderator
    Post count: 29970

    If I remember right, you are not using the location indicator.
    Does the category count also show zero at yoursite.com/location ?
    How do you know you are not in a location that has no listings for a particular category if you do not use the location switcher?

    A URL would be handy to check.

    #10135

    dnosker
    Buyer
    Post count: 68

    I do not show any category counts at /location. Just the map.

    for a location switcher I use the same method as the online demo for all locations. and this method works just fine for switching locations. See how it is done here:
    http://wpgeo.directory/all-locations/

    I have made a screenshot clearly showing a listing (One of many) in the Restaurants category and the popular categories on the right showing (0) for that example category…

    #10147

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    can you please provide links instead of Images (which are totally useless for us)?

    Thanks,

    #10148

    dnosker
    Buyer
    Post count: 68

    Site is not on a public server yet so I want at this time to change the code that displays this.

    I am looking for someone to tell me where the code is that displays the (0) and then I will go remove it from my copy of the plugin. I am not interested in fixing it on my site as I don’t want even a correct number displayed.

    I know that many free directory listing scripts have an option to not display the number listed so maybe this can be also done in the future?

    But in the mean time, if someone would be so kind to point me to the block of code that displays this I can remove it from my copy.

    Thanks for the help!

    #10153

    Paolo
    Site Admin
    Post count: 31206

    Haven’t tested it, but should be:

    geodirectory/geodirectory-widgets/geodirectory_popular_widget.php

    line to be edited:

    from

    
    
    echo ucwords($cat->name).' (<span class="geodir_term_class geodir_link_span geodir_category_class_'.$post_type.'_'.$cat->term_id.'" >'.$total_post.'</span>) ';
    

    to

    
    
    echo ucwords($cat->name);
    

    If you modify the plugin widget directly you will lose the changes after every new update.

    The best thing to do, would be to copy the entire widget code and registration action. Copy the code in your theme functions.php file, rename the class and function name, modify the widget description and update the class name in the register_widget call.

    At this point you will have your new popular post category widget in your theme and you can modify it as you wish without having to deal with plugin updates.

    Thx

    #10154

    dnosker
    Buyer
    Post count: 68

    Thanks much Paolo, that was exactly what I was looking for! 🙂

    — Dave

    #10158

    Paolo
    Site Admin
    Post count: 31206

    you’re welcome! 🙂

Viewing 12 posts - 1 through 12 (of 12 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket