WordPress.org

Forums

Category Post Counts (14 posts)

  1. Altstatten
    Member
    Posted 8 years ago #

    Okay, read every post I could find on this and found no answer that works or is complete so here goes.

    Added this---><?php wp_list_cats('sort_column=name&optioncount=1&hide_empty=0'); ?>

    ...to get counts of posts in each category.

    Problem: The counts are not next to the category name, but are below it on the next line.

    This seems to be a common problem and the fix offered most often is an adjustment to the css file. The only detail offered that I can find was to add a line in the "Sub-Comment" area but my CSS file doesn't HAVE a sub area.

    ALL I NEED is for someone to tell me how to get the count to display next to the category name. I loaded my css file in a post over a week ago but no one tackled it, hence the new post.

    Can anyone offer me instruction and a line of code that will remedy this please?

  2. Chris_K
    Member
    Posted 8 years ago #

    If you're asking for help with your theme (and you are) a link to it is beyond priceless for the folks who may be able to help.

  3. alakhnor
    Member
    Posted 8 years ago #

    wp_list_cats is deprecated with WP 2.1. Use wp_list_categories and show_count.

  4. Evrviglnt
    Member
    Posted 8 years ago #

    v 2.1.2

    I'm misunderstanding that answer. I did the what Alakhnor said and the category numbers still come out underneath the words...

  5. Chris_K
    Member
    Posted 8 years ago #

    Maybe I was too subtle?

    A link to your blog, where this can be observed, would be really helpful.

    If that's not possible, perhaps sharing with us the theme name (if not homemade) would be a reasonable substitute.

    You're asking for help with CSS, but not giving anyone a look at what you currently have.

  6. Altstatten
    Member
    Posted 8 years ago #

    Same here. Here's my line of code:

    <?php wp_list_categories('title_li=&sort_column=name&show_count=1'); ?>

    http://marketingmeasure.com

  7. Evrviglnt
    Member
    Posted 8 years ago #

    Here's my site.

    And my line in CSS:

      <?php wp_list_categories('show_count=name&optioncount=1&hide_empty=0'); ?>

    Here is my theme - rockinbizred3col 1.2

  8. Altstatten
    Member
    Posted 8 years ago #

    Theme is Vertigo Enhanced.
    And I DID give my entire css file in a previous post but my query was ignored so I didn't want to give it again.

    My url is http://marketingmeasure.com.

    Be happy to post my css again if you like. Thanks for your help!

  9. JoyceD
    Member
    Posted 8 years ago #

    I think the problem is that the links to the categories are displayed as blocks (display: block in your CSS), this forces the post counts to the next line. There's a line in your CSS that was probably put there to prevent this (#l_sidebar ul.categories li a {display: inline;}) but it doesn't work because it should say li#categories instead of ul.categories. Hope that helps.

  10. Evrviglnt
    Member
    Posted 8 years ago #

    Thanks Joyce - your input pushed me along to the answer. I went out and found a theme that had numbered categories, copied the code and pasted it into the spot where the undesired code was. I went to the style sheet and changed the display to 'inline' and it worked!

    Problem solved!

    Thanks!

  11. Altstatten
    Member
    Posted 8 years ago #

    :) Wanna share with the rest of us what that code was??

  12. Altstatten
    Member
    Posted 8 years ago #

    Let's try this again........

    Problem: Category post counts defaulting to the next line.

    My function line: <?php wp_list_categories('show_count=1&title_li=&sort_column=name'); ?>

    My relevant CSS:

    /************************************************
    * Left Sidebar *
    ************************************************/

    #l_sidebar {
    float: left;
    width: 225px;
    margin: 25px 0px 0px 20px;
    padding: 0px 0px 20px 0px;
    border-top: 2px solid #000000;
    }

    #l_sidebar ul {
    list-style: inline;
    margin: 0px;
    padding: 0px;
    }

    #l_sidebar ul li {
    display: inline;
    padding: 0px;
    margin: 0px;
    }

    #l_sidebar ul li a {
    display: block;
    color: #000000;
    text-decoration: none;
    margin: 0px;
    padding: 5px 0px 5px 0px;
    border-bottom: 1px solid #C0C0C0;
    }

    #l_sidebar ul li a:hover {
    background: #EFEFEF;
    color: #910156;
    }

    #l_sidebar p{
    padding: 3px 0px 0px 0px;
    margin: 0px;
    line-height: 20px;
    }

    Can someone please tell me with some authority where the error is? Please.

  13. JoyceD
    Member
    Posted 8 years ago #

    Alstatten, my previous reply was actually directed to you. Add this line to your CSS:

    li.Categories li a { display: inline }

  14. Altstatten
    Member
    Posted 8 years ago #

    Yes, I know. But I haven't been able to get any combination to work. I've tried:

    This: #l_sidebar li.Categories li a { display: inline }

    This: li.Categories li a { display: inline }

    This: #l_sidebar ul li a {
    display: block;
    color: #000000;
    text-decoration: none;
    margin: 0px;
    padding: 5px 0px 5px 0px;
    border-bottom: 1px solid #C0C0C0;
    }

    This: #l_sidebar li.Categories li a {
    display: block;
    color: #000000;
    text-decoration: none;
    margin: 0px;
    padding: 5px 0px 5px 0px;
    border-bottom: 1px solid #C0C0C0;
    }

    This: #l_sidebar li.Categories li a {
    display: inline;
    color: #000000;
    text-decoration: none;
    margin: 0px;
    padding: 5px 0px 5px 0px;
    border-bottom: 1px solid #C0C0C0;
    }

    Nothing works. Please advise.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags