• Im hoping to have my categories display inline like this:

    Category (6), Other Category (4), Category3 (2),

    But i can’t find a way to add the comma suffix, so currently it looks likes this:

    Category (6) Other Category (4) Category3 (2)

    Can anyone help?

    What i have is this:
    <?php wp_list_categories('show_count=1&orderby=count&order=desc&title_li='); ?>
    (Im using display:inline to make the li tags run in a single line.)

Viewing 4 replies - 1 through 4 (of 4 total)
  • trebtreb,

    With the suffix your categories would look like this:

    ,Category (6), Other Category (4), Category3 (2),

    Note the comma at the beginning.

    Thread Starter trebtreb

    (@trebtreb)

    That’s ok, even that’s closer then what i currently have.
    How do i do it?

    Thread Starter trebtreb

    (@trebtreb)

    *bump*
    Can anyone help with this?

    trebtreb,

    Sorry for the slow response. Open wp-includes/classes.php and look for the the following if statement on line 1331:

    if ( $use_desc_for_title == 0 || empty($category->description) )
    $link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"';
    else
    $link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"';
    $link .= '>';
    $link .= $cat_name . '</a>';

    On this last line: $link .= $cat_name . ”; add a comma after the closing link tag like so:

    $link .= $cat_name . '</a>,';

    This will add a comma suffix. I had prefix on the mind in the previous post because of a recent article I had read.

    Good luck.

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

The topic ‘wp_list_categories suffix?’ is closed to new replies.