• Hello

    I’m trying to colour-coordinate the category links at the bottom of my posts.

    So, for example, if a post were filed in the ‘Advice’ category, the link at the bottom of the post would have a black background; whilst the ‘Writing’ category might have a blue background.

    This would then be used with a similarly colour-coordinated menu for easy navigation.

    I don’t know if it uses WordPress, but there’s a good example of what I’m aiming for here: https://www.greentraveller.co.uk/blog

    I found out how to change category-formatting on the menu from here: https://www.killersites.com/mvnforum/mvnforum/viewthread_thread,11487. But that doesn’t change the links that actually appear on the post.

    Is this possible?

    Any help much appreciated.

    Thanks for your time,
    Tim.
    https://thenextchallenge.info

Viewing 3 replies - 1 through 3 (of 3 total)
  • if it does not exist, you can build it yourself.

    instead of:
    <?php the_category(', '); ?>

    you could use:

    <?php
    $cats = get_the_category($post->ID);
    $sep='';
    foreach($cats as $kitten) :
    if($sep) echo ', '; $sep=1;
    echo '<a href="'.get_category_link($kitten->term_id).'" title="view all posts in '.$kitten->name.'" class="cat-item-'.$kitten->term_id.'">'.$kitten->name.'</a>';
    endforeach;
    ?>

    and you can format it in style.css (for instance):

    a.cat-item-7 { ... }
    a.cat-item-7:hover { ... }

    Thread Starter Tim Moss

    (@timmoss10)

    Thanks for that alchymyth.

    I can’t find this anywhere:

    <?php the_category(', '); ?>

    I’m pretty new to this but I guess it’s something to do with the theme I’m using (Thematic).

    If it’s just me being daft then please do shout. Otherwise, I’ll try posting on the Thematic forum.

    Thanks again for taking the time to help.

    Tim.

    Otherwise, I’ll try posting on the Thematic forum.

    probably the best idea, as thematic is ‘very’ different … ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Changing formatting for individual category links’ is closed to new replies.