How to create Categories similar to Lamebook?

Discussion in 'Blogging' started by razz.jazz, Feb 15, 2011.

  1. #1
    Lamebook has a list of categories with a background image. Anyone know how they do this with the icon/symbol in the corner related to each post?
     
    razz.jazz, Feb 15, 2011 IP
  2. Dodger

    Dodger Peon

    Messages:
    1,494
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
    #2
    That is simple. For every category in the list, WordPress assigns a class for that category to identify it. The class name is in the form cat-item-xxx where the xxx is the ID number of the category.

    In your stylesheet you need to assign a background image for each category list item. In the Lamebook example for douchebags (seemed like as good a category as any) the Html has

    
    <li class="cat-item cat-item-158">
          <a title="View all posts filed under Douchebags/Douchebaguettes" href="http://www.lamebook.com/category/douchebags/">Douchebags/Douchebaguettes</a>
    </li>
    
    Code (markup):
    The CSS for class cat-item-158 and other rules that may apply are:

    
    #categories ul, #categories li {
      list-style-type: none;
      margin: 0;
      padding: 0;
    }
    
    .cat-item-158 {
      background: url("http://static.lamebook.com/wp-content/themes/lamebook/images/cat-douchebags.png") no-repeat scroll 0 50% transparent;
    }
    
    li.cat-item a {
      border-bottom: 1px solid #77B5DC;
      color: #0B77BD;
      display: block;
      padding: 9px 0 9px 30px;
    }
    
    
    Code (markup):
     
    Dodger, Feb 15, 2011 IP