Can you get a posts category ID?
-
I want to make a different color which represents each category via CSS. To do this, I need to be able to get the category ID and add make that a class name.
I’ve highlighted in the post_html where I want the category ID to be.
<?php if ( function_exists('wpp_get_mostpopular') ) { $args = array( 'excerpt_length' => 200, 'title_length'=> 36, 'post_type' => 'post', 'limit' => 6, 'post_html' => '<div class="most-popular-box cat-[CATEGORY ID HERE]"><div class="wpp-excerpt"><div class="popular-box-thumbnail">{thumb}</div><p class="popular-box-title">{title}</p><a href={url}><p class="popular-box-summary">{summary}</p></a></div><footer>{category}</footer></div>', 'range' => 'all', 'stats_category' => 1, 'thumbnail_width' => 300, 'thumbnail_height' => 60, 'stats_category' => 1 ); wpp_get_mostpopular( $args ); } ?>
Is this possible to do?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Can you get a posts category ID?’ is closed to new replies.