Support » Fixing WordPress » How to display post from certain category?

  • Resolved johhny

    (@johhny)


    Hi,

    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[0]->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.

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to display post from certain category?’ is closed to new replies.