• Im running into issues styling the html output of the wp_get_archives function.

    Currently outputs:
    <li><a href='#' title=''>January 2011</a> (4)</li>

    I am trying to style the links as blocks with rollover background images but the post count is breaking the design.

    What is the typical way to style these widgets with post counts?

    Can I somehow change the output of the html to include the post count within the link text?

Viewing 3 replies - 1 through 3 (of 3 total)
  • might work with a filter function:

    add_filter('get_archives_link', 'archive_count_inline');
    function archive_count_inline($links) {
    $links = str_replace('</a>&nbsp;(', ' (', $links);
    $links = str_replace(')', ')</a>', $links);
    return $links;
    }

    add this to functions.php of your theme.

    http://codex.ww.wp.xz.cn/Plugin_API

    Thread Starter AMCD

    (@amcd)

    Excellent! That did the trick… I’m assuming something similar will work with the categories links as well?

    If your willing to give up that function as well you would be my hero 🙂

    Thanks!

    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;
    }
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Styling wp_get_archives with post counts’ is closed to new replies.