Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • alchymyth
    THANK YOU SO MUCH!

    hmmm *wonders why it is $links and not $variable*
    – how does one know what parameter to pick?!

    php nube here 🙁

    would love to know this too – i have searched and search

    i managed to do this with the wp_categories_list in my child theme as follows:

    // remove parentheses from category list and add span class to post count
    function categories_postcount_filter ($variable) {
    $variable = str_replace('(', '<span class="post-count"> ', $variable);
    $variable = str_replace(')', ' </span>', $variable);
       return $variable;
    }
    add_filter('wp_list_categories','categories_postcount_filter');

    alas replacing wp_list_categories with wp_get_archives has no impact.

    Anyone any ideas?

    Thread Starter st3vi3

    (@st3vi3)

    the css is as follows

    .post-count
    {position: relative;
    float: right;
    padding-right: 8px;}
    Thread Starter st3vi3

    (@st3vi3)

    ha – so i managed to find the solution

    okay – so
    if you are using a child theme – and filtering through your functions.php document this code will allow you to remove the parentheses from the post count in the wp_categories_list

    and it will also add a class “post-count” which can then be used in your style.css to re-align the count

    function mam_list_categories_filter ($variable) {
    $variable = str_replace(‘(‘, ‘<span class=”post-count”> ‘, $variable);
    $variable = str_replace(‘)’, ‘ </span>’, $variable);
    return $variable;
    }
    add_filter(‘wp_list_categories’,’mam_list_categories_filter’);

    Thread Starter st3vi3

    (@st3vi3)

    hey
    thank you so much… worked perfect!
    now i know i need to get to exploring parameters some more.
    just one more thing… how could i add a style within this function
    basically to right justify the post counts?

    Many many thanks!

Viewing 5 replies - 1 through 5 (of 5 total)