• Resolved erniegarcia

    (@erniegarcia)


    My AVH Extended Categories Widgets are not displaying the post count inline, instead the post count appears on the line below.

    Is there anyone here that knows how to fix this?

    My website:
    http://tinyurl.com/682k3tc

    WordPress Theme:
    Habitat

Viewing 7 replies - 1 through 7 (of 7 total)
  • this is cause by a display: block; format on the links, while the numbers are ourside the linked text.

    for the standard category widget, adding some code like this to functions.php of the theme works:

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

    you probably need to check if your plugin uses a similar filter hook.

    Thread Starter erniegarcia

    (@erniegarcia)

    Hi alchymyth,

    A week ago you helped me fix the post count problem for my standard category and archive widget. You suggested I insert the following code below and it corrected the issue.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    I can’t for the life of me however fix the same post count issue for my AVH Extended Categories Widgets. My coding skills are really weak, so I’m totally stumped as to what step to do next. The author of the wp theme that I’m using suggested I use a string replace function, but I don’t know how to construct/write one of those.

    the plugin widget seems to add an extra div to the cat count, which needs a different filter:

    try to add this to functions.php of your theme:

    add_filter('wp_list_categories', 'avh_cat_count_inline');
    function avh_cat_count_inline($links) {
    $links = str_replace('</a><div class="avhec-widget-count"> (', '<div class="avhec-widget-count"> (', $links);
    $links = str_replace(')', ')</a>', $links);
    return $links;
    }
    Thread Starter erniegarcia

    (@erniegarcia)

    This perfectly corrected the issue in Opera 10.63, however there are still some display errors in IE, FireFox, and Chrome.

    In FireFox 3.6.13 and Chrome 9, it placed the post count on a new line, complete with a line arrow.

    In IE 8 it’s almost totally fixed, however the second line for each widget has too much top line padding [+4px].

    Screenshots:

    IE8: http://tinyurl.com/6zp4uzv
    FireFox: http://tinyurl.com/6l59ca5
    Chrome: http://tinyurl.com/6xa5f5r

    i see.
    try this:

    add_filter('wp_list_categories', 'avh_cat_count_inline');
    function avh_cat_count_inline($links) {
    $links = str_replace('</a><div class="avhec-widget-count"> (', '<span class="avhec-widget-count"> (', $links);
    $links = str_replace(')</div>', ')</span></a>', $links);
    return $links;
    }

    this changes the div into a span (for valid html code), and takes care for the closing element as well (which i forgot before)

    and because you don’t use the normal category widget, make sure you don’t have this at the same time (remove this from functons.php, otherwise it will interfere):

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

    Thread Starter erniegarcia

    (@erniegarcia)

    Awesome, that fixed it! Thank you so much alchymyth, I really appreciate all of your help.

    it works , thanks

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

The topic ‘Post Count Alignment Problem’ is closed to new replies.