WordPress.org

Ready to get started?Download WordPress

Forums

[closed] Adding classes based on category (2 posts)

  1. c001os
    Member
    Posted 1 year ago #

    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'); ?>
  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic