post type category name in query

Solutions on MaxInterview for post type category name in query by the best coders in the world

showing results for - "post type category name in query"
Anna
11 Oct 2016
1$args = array(
2        	'post_type' => 'post',
3        	'posts_per_page' => 4
4        );
5        $query = new WP_Query( $args );
6
7	     if( $query->have_posts() ) {
8    	    while( $query->have_posts() ) : $query->the_post(); 
9                foreach((get_the_category()) as $category) { 
10                  echo $category->cat_name . ' '; 
11                } 
12        endwhile;
13		} 
14		else {
15	    	echo "There is no posts";
16	    }
17
18	    wp_reset_postdata();   ?>