I have this widget, basically recent post widget. But I want the widget to display certain posts in certain category. For example,
Home tab (no widget)
People tab (people posts only)
Animal tab (animal posts only)
here’s the snippet of coding I tried to change;
$category = get_the_category();
$current_category = $category->term_id;
$r = new WP_Query( apply_filters( ‘widget_posts_args’, array( ‘posts_per_page’ => $number, ‘cat’ => $current_category, ‘no_found_rows’ => true, ‘post_status’ => ‘publish’, ‘ignore_sticky_posts’ => true ) ) );
in original recent widget codes, there are no italic one. please help.
- The topic ‘How to display post from certain category?’ is closed to new replies.