How to get a category in a list item class
I am need to know how would I get the category to be dynamically input in a WP_Query
This is the code I am using:
li class="?php the_category(' ')?"
but the output is breaking.
This is all the code
ul id="portfolio-list"
?php
$args = array(
'post_type' = 'post',
'post__and' = array( 15, 14, 17, 13, 10, 8, 12, 11, 9, 16),
);
$the_query = new WP_Query( $args );
?
?php if ( $the_query-have_posts() ) :?
?php while ( $the_query-have_posts() ) : $the_query-the_post(); ?
li class="?php the_category(' '); ?"
?php the_post_thumbnail( $size, $attr ); ?
?php the_title(); ?
br /
?php //the_category('cat-slug'); ?
?php endwhile; else: ?
pThere are no posts or pages here/p
?php endif; ?
?php wp_reset_postdata(); ?
/li
/ul