Thread: Wordpres Help
View Single Post
Old 07-30-2012, 03:59 PM  
The Dawg
Confirmed User
 
The Dawg's Avatar
 
Join Date: Apr 2002
Location: State Of Bliss
Posts: 2,438
Quote:
Originally Posted by Colmike7 View Post
Hm, I'll have to think about that one. I can only think of doing that by overriding the text html based on the category by making a custom category list for the sidebar or maybe by using separate CSS files for each category using 'in_category' like this:


<link rel="stylesheet" href="<?php bloginfo('template_url')?>/default.css" type="text/css" />

<?php
if( in_category( 1 ) )
{
?>
<link rel="stylesheet" href="<?php bloginfo('template_url')?>/cat1.css" type="text/css" />

<?php } elseif ( in_category (2) )
{
?>
<link rel="stylesheet" href="<?php bloginfo('template_url')?>/cat2.css" type="text/css" />

<?php } elseif ( in_category (3) )
{
?>
<link rel="stylesheet" href="<?php bloginfo('template_url')?>/cat3.css" type="text/css" />
<?php } else { ?>

<?php } ?>
Thanks.
Thats pretty long stuff there and I'd have to update it every time I added a new category. I got it to work a specific category ID:

Code:
<?php
$args=array(
  'orderby' => 'name',
  'order' => 'ASC'
  );
$categories=get_categories($args);
  foreach($categories as $category) {
if ($category->cat_ID == '4') {
echo '<p style="background-color:#eccad3;"><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View %s Links" ), $category->name ) . '" ' . '>' . $category->name.'</a> </p> ';
}
else { echo '<p><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View %s Links" ), $category->name ) . '" ' . '>' . $category->name.'</a> </p> '; }
}
?>
The Dawg is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote