Support » Themes and Templates » Adding separators to categories (existing code)

  • Resolved ggg377

    (@ggg377)


    I have this php code to display categories:

    <span class="cat-links">
    <?php
    foreach((get_the_category()) as $category) {
        echo '<span id="'.$category->slug . '"><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name . '</a></span>'; $separator = ' ';
    }
    
    ?>
    </span>

    I looked up the codex for get_the_category and it says $separator = ‘ ‘; would add a space between the categories. But wherever I place it even when using the ; symbols properly, it either does nothing or it loses the odd-colored tag with a different class in my example (test). I would appreciate all help or hints.

    example: http://goldenred.web44.net/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding separators to categories (existing code)’ is closed to new replies.