Is it possible to change only the category's tag colour?

edited December 2011 in Vanilla 2.0 - 2.8

Is it possible to change only the category's tag collor?

Best Answer

  • KastangKastang New
    Answer ✓

    Its fairly simply to do:

    Move applications/vanilla/views/discussions/helper_functions.php
    to themes/[YOURTHEME]/views/discussions/helper_functions.php

    Find:

     if (C('Vanilla.Categories.Use') && $Discussion->CategoryUrlCode != '')
          echo Wrap(Anchor($Discussion->Category, '/categories/'.rawurlencode($Discussion->CategoryUrlCode), 'Category'));
    

    Change To:

    if (C('Vanilla.Categories.Use') && $Discussion->CategoryUrlCode != '')
         echo Wrap(Anchor($Discussion->Category, '/categories/'.rawurlencode($Discussion->CategoryUrlCode), 'Category_'.$Discussion->CategoryID));
    

    This will add a unique tag to each category class in the form of Category_{CATEGORYID}. You can wrap the classes in whatever colors you want using CSS then.

Answers

  • change them in the css?

  • I want to do it individually, so e.g. category 1 = yellow, category 2 = blue ...

  • KastangKastang New
    Answer ✓

    Its fairly simply to do:

    Move applications/vanilla/views/discussions/helper_functions.php
    to themes/[YOURTHEME]/views/discussions/helper_functions.php

    Find:

     if (C('Vanilla.Categories.Use') && $Discussion->CategoryUrlCode != '')
          echo Wrap(Anchor($Discussion->Category, '/categories/'.rawurlencode($Discussion->CategoryUrlCode), 'Category'));
    

    Change To:

    if (C('Vanilla.Categories.Use') && $Discussion->CategoryUrlCode != '')
         echo Wrap(Anchor($Discussion->Category, '/categories/'.rawurlencode($Discussion->CategoryUrlCode), 'Category_'.$Discussion->CategoryID));
    

    This will add a unique tag to each category class in the form of Category_{CATEGORYID}. You can wrap the classes in whatever colors you want using CSS then.

  • Hello, is a good plugin but you should use compatible php5 code , not is recommended to use <? short tags in this times, not its supported for most servers.

    regards,

Sign In or Register to comment.