WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Linking category links to CSS a: styles

[Resolved] Linking category links to CSS a: styles

  • Hey there, if anyone could help me i’d kiss you.. I’m going crazy!!

    I’m currently working on a new version of a site I run, NEATO

    Check it out here: http://www.neato.me/0915
    – You see the category links underneath each posts are different colors, the colors correspond with the side menu bar color.

    – THE PROBLEM: is they aren’t linking to separate categories, clicking on Science, etc.. will always link to ALL

    Any solutions?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The first NEATO theme built from the ground up

    should be easy as this seems to be total custom theme:

    what is the coding (in index.php?) for those category links (in the ‘postmetadata’ div) below the posts on the front page?

    from the single posts, the categories are linking ok;
    possibly get the corresponding code from single.php and use it in index.php.

    Hey there, thanks for the help.

    The single posts don’t have the color-specific code yet. I’ve added it to make it easier.

    This is the code to change the category colors:

    <?php $the_cat = get_the_category(); $category_link = get_category_link( $the_cat[0]->cat_ID ); foreach((get_the_category()) as $category) { echo '<a class="'.$category->slug.'" href="'.$category_link.'">  '.$category->cat_name.'</a>' ; } ?> / <?php _e('by'); ?> <?php  the_author_link(); ?> /
                    <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>

    no wonder – you are getting one fixed category link and using this for all categories;

    change the code to:

    <?php foreach( get_the_category() as $category ) { echo '<a class="'.$category->slug.'" href="'.get_category_link($category->term_id).'">  '.$category->cat_name.'</a>' ; } ?> / <?php _e('by'); ?> <?php  the_author_link(); ?> /
                    <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>

    Wow you beautiful human!! Thank you!!

    Check it out! http://www.neato.me/0915/

    Thank you again,
    Will

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Linking category links to CSS a: styles’ is closed to new replies.
Skip to toolbar