php - Wordpress "get_post_class" get category as string -
as title states, want output class of category onto looped queries.
at moments use post class want add 1 class , have set number of classes. me getting 1 or more values array , echo'ing them out string loop template.
array(7) { [0]=> string(8) "post-170" [1]=> string(4) "post" [2]=> string(9) "type-post" [3]=> string(14) "status-publish" [4]=> string(15) "format-standard" [5]=> string(6) "hentry" [6]=> string(22) "category-uncategorised" } currently
<?php $counter = 0; $query = new wp_query(array( 'post_type' => 'post', 'posts_per_page' => '50' )); if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?> // update counter $counter++; <div class="newsfeed__blk <?php echo 'is--' . $counter; ?> col-md-4 col-sm-6 col-xs-12 <?php get_post_class([6]); ?>">...</div> <?php endwhile; endif; wp_reset_query(); ?> end result
i want newsfeed testimonials. in wordpress assign category post. when page rendered query add custom class differentiate dom element custom scss styles.
Comments
Post a Comment