Show custom post type with the same category
-
I’ve read tutorials about showing custom post type with the same category but it seems that all I get was the same posts from the main loop. I want to display custom post type named ‘content_block’ (it’s from the Custom Post Widget) in the sidebar. Here’s my code:
$custom_event = new WP_Query(array(‘post_type’ => ‘content_block’, ‘posts_per_page’ =>5));
while ($custom_event->have_posts() ): $custom_event->the_post();
echo the_title();
echo ‘</br>’;
echo the_content();
echo ‘</br>’;endwhile;
It doesn’t display the custom post type content_block but instead the post from the main loop (which is another custom post type)
Please help me. ??Thank you in advance.
- The topic ‘Show custom post type with the same category’ is closed to new replies.