How to style category output

I got a little help from somebody and have been using the following to diplay my category titles under each post (magazine style wordpress blog). It also excludes a category which the theme relys on (every post must be part of this cat to be displayed on the front page).

<?php
    // For each of the categories, create them as category variables
    foreach((get_the_category()) as $category) {
        // If the category is NOT the cat_name (category name) then echo some stuff
        // So grab all... except where they match cat_name (exclude basically)
        if ($category->cat_name != 'Featured') {
            echo '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> ';
        }
    }
?>

However, I would like to style each displayed category title ie;

Read More

From this

Movie Music TV Funny

To this

[Movies] [Music] [TV] [Funny]

Is this easily done? Can able point me in the right direction?

Related posts

Leave a Reply

2 comments

  1. Just modify this line:

    echo '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>[' . $category->name.']</a> '; 
    //added [ = [ and ] = ]
    
  2. echo '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>[' . $category->name.']</a> ';