• I’m currently using <?php wp_list_categories('orderby=name&show_count=1&hierarchical=0&title_li='); ?> to output my categories list into my sidebar. I’m wanting to modify the style slightly so that when the list of cats is outputted into each <li></li> the total number of posts within that category is outputted next to it. It seems that the count is outside of the <a></a> block element during output. I’ve been searching through the codex, support forums and even looked into hacking up the function that is outputting the code itself and I cannot find a resolution.

    Currently the output is as such:

    CategoryA
    (2)
    CategoryB
    (9)
    CategoryC
    (19)

    and I want it to appear as:
    CategoryA (2)
    CategoryB (9)
    CategoryC (19)

    so on and so forth, I checked into my style, tried everything I can think of .. any assistance is appreciated.

Viewing 10 replies - 1 through 10 (of 10 total)
  • It seems that the count is outside of the block

    It should – and to change that you would need to modify core files.

    What you describe is a simple CSS issue but I couldn’t check it on the site linked to your profile.

    Thread Starter justinshattuck

    (@justinshattuck)

    moshu: Which core file(s) would I have to modify to place it within the block?

    moshu.. can u look at my site
    https://www.seriegrossisten.se/blogg/

    got the same problem.. tried and tried to edit the css but can’t get it to work….

    please….

    The question one has to ask is why is the count placed outside of the link, this is maddness ? One wonders if anyone notices these little things when developing wordpress, the most simplest things are often overlooked, can I get a fraken spoon with my bowl of soup * grin *

    OT. Is there a good reason why the total needs to be in a link?

    doh! was thinking that myself ?? even still, show count within the < li > never lines up anyway which is surpising

    It is inteesting. The number is just hanging there in space. It is uncontained text (no markup). One of my pet hates. Hacking is needed.

    Hey there, i got the same problem in my blog. Doea anyone knows how to solve it?

    Thx!

    For the count-in-the-link-issue, here’s the solution.

    OT. Is there a good reason why the total needs to be in a link?
    Yes. If you use display:block for the links (i.e. to get a nice hover which styles the entire line), a seperate line for the post-count is very annoying. I was really surprised to see that wp_list_categories (resp. walker_category) doesn’t include it in the link by default.

    I found a workable solution in classes.php

    if ( isset($show_count) && $show_count )
    $link .= ‘<span>(‘ . intval($category->category_count) . ‘)</span>’;

    this puts a < span > tag around the count then for CSS i used this

    position: relative;
    float: right;
    top: ;
    left: ;

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Additional Styling to Category List’ is closed to new replies.