Activity Stream
48,167 MEMBERS
6875 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 2 of 2
  1.     
    #1
    Member

    Default Different css for different category.

    Ok, i would like to have, differen CSS for post titles for each different category.
    For example.
    All posts from category a coloured red
    All posts from category b coloured green

    Here are some codes i have tryed and people are sayign that they are working but why dont they work for me?
    My post titles defautl colour is fetched from post.css and not basic.css

    The codes i tryed:

    Code: 
    1. get the cat id nr. like "194" for w33d on www.something.kom
    2. <h2 id="color_<?php foreach((get_the_category()) as $category) { echo $category->cat_ID . '';} ?>">blaaaaaaaaaablaaaaaaaaaaaaablaaaaaaaaaaaa</h2>
    3. CSS file like
    4. #color_194 a {
    5. color:#99FF00;
    6. }
    This one

    Code: 
    open file -> index.php
    
    past code under
    <div class="post-header">
    ------------------------------------------------------------------------------
    <h2 id="color_<?php foreach((get_the_category()) as $category) {
        echo $category->cat_ID . '';
    } ?>">
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
    ------------------------------------------------------------------------------
    
    go to your theme folder => stylesheets folder
    open file -> basic.css
    XXXXXXXXXXXX = your cat ID
    ------------------------------------------------------------------------------
    .post-header #color_XXXXXXXXXXXX a {
        color:#FFFF00;
        text-decoration: none;
        font-family: Verdana;
        font-size: 11px;
    }
    .post-header #color_XXXXXXXXXXXX a:hover {
        text-decoration: underline;
        border: none;
        color:#FFFF00;
    }
    .post-header #color_XXXXXXXXXXXX a:visited {
        border-bottom: 1px dotted;
        text-decoration: none;
    }
    And this one

    Code: 
    1. Post that code in your <head>......</head>
    2. Different CSS For Categories
    3. For having different CSS for the categories use the following code :-
    4. <?php if( is_category( 1 ) ) { ?>
    5. <link rel=?stylesheet? href=?URL of style1.css? type=?text/css? media=?screen? />
    6. <?php } elseif ( is_category (2) ) { ?>
    7. <link rel=?stylesheet? href=?URL of style2.css? type=?text/css? media=?screen? />
    8. <?php } elseif ( is_category (3) ) { ?>
    9. <link rel=?stylesheet? href=?URL of style2.css? type=?text/css? media=?screen? />
    10. <?php } else { ?>
    11. <link rel=?stylesheet? href=?URL of style.css? type=?text/css? media=?screen,projection? />
    12. <?php } ?>
    13. Here 1,2&3 represents Category ID?s and style1.css, style2.css & style3.css represents their different CSS repectively.
    14. http://www.dailytechpost.com/index.php/different-css-styles-for-different-pages-and-categories-in-wordpress/
    r00ts Reviewed by r00ts on . Different css for different category. Ok, i would like to have, differen CSS for post titles for each different category. For example. All posts from category a coloured red All posts from category b coloured green Here are some codes i have tryed and people are sayign that they are working but why dont they work for me? My post titles defautl colour is fetched from post.css and not basic.css The codes i tryed: Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    imdber.org justpaste.me
    Try any of them, right click on the element > inspect element. See from what file that element is being styled to. You can PM me the site so I can help you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Different CSS per category.
    By pi0tr3k in forum phpBB
    Replies: 10
    Last Post: 18th Jan 2012, 05:06 PM
  2. No category base in url
    By t3od0r in forum Wordpress
    Replies: 8
    Last Post: 13th Jun 2011, 01:27 PM
  3. Category headings.
    By neilbla in forum vBulletin
    Replies: 5
    Last Post: 22nd Dec 2010, 03:59 PM
  4. Get RSS of category ?
    By chipve in forum Webmaster Discussion
    Replies: 3
    Last Post: 16th Oct 2010, 05:24 PM
  5. XXX category
    By Pirate in forum Webmaster Discussion
    Replies: 9
    Last Post: 26th Sep 2010, 06:30 PM

Tags for this Thread

BE SOCIAL