• Resolved yochi

    (@yochi)


    Hi

    I have been googeling all day now, trying to find a solution to my problem.

    I want to modify the output of my Categories widget so that it puts a span class or something around the post count, so i can style it the way i want.

    Does anyone have a suggestion how i can do this?

    yochi

Viewing 2 replies - 1 through 2 (of 2 total)
  • try to add a filter function to functions.php of your theme;
    for instance:

    add_filter('wp_list_categories', 'add_span_cat_count');
    function add_span_cat_count($links) {
    $links = str_replace('</a> (', '</a> <span>(', $links);
    $links = str_replace(')', ')</span>', $links);
    return $links;
    }

    if you need a css class on the span, add it here in the above:
    <span>
    for instance:
    <span class="cat-count">

    Thread Starter yochi

    (@yochi)

    Thank you very much. That worked:)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change html output in categories widget’ is closed to new replies.