Adding different classes to custom post type
-
I was wondering if it was possible to define a class within each custom post type entry?
I created a new custom post type and its corresponding taxonomy and they are pulling into the site just fine. I have them displayed using and unordered list and i was wondering if you could custom define the class of each entry so the < li > of each post would contain the class of the post. The reason is i need custom icons to match category they are within that custom post type.
For example here is my custom post type for “Chamber News”
<?php $custom_post_type = 'chamber-news'; $args=array( 'post_type' => $custom_post_type, 'post_status' => 'publish', 'posts_per_page' => 5, 'caller_get_posts'=> 1 ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { // echo 'List of Chamber News'; while ($my_query->have_posts()) : $my_query->the_post(); ?> <ul class="chamber-news-preview"> <li> <?php the_content(); ?> </li> </ul> <?php endwhile; } wp_reset_query(); // Restore global post data stomped by the_post(). ?>But, I’d like to tag the < li > with a class such as: “community”, “event”, “public”, and “private”. Is there anyway to accomplish this? Thank you so much in advance!!
The topic ‘Adding different classes to custom post type’ is closed to new replies.