Support » Fixing WordPress » Adding classes based on category

  • Hi!

    I want to assign dynamicaly classes to posts based on their categories. This is my code where i want to implement this:

    <?php $categories = get_the_category($page->ID); $cat_name = $categories[0]->slug; ?>
    <?php query_posts('post_type=projekt&category_name='.$cat_name.'&posts_per_page=1'); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Adding classes based on category’ is closed to new replies.