I would like to be able to add a class to posts from a query (which would appear under the element, however I have only figured out how to wrap the posts with which doubles up the element. I can’t see a parameter for query_posts() to do this. Is it possible to use post_class() somehow in this loop?
$args = unserialize( stripslashes( $_POST['query'] ) ); $args['paged'] = $_POST['page'] + 1; $args['post_status'] = 'publish'; query_posts( $args); if( have_posts()) : ?> <article class="newcomment"><?php while( have_posts() ): the_post(); get_template_part( 'loop-templates/content', get_post_format() ); endwhile; endif;
Read more here: Add class to query_posts loop