Support » Plugins » How do i filter posts in Home page.

  • Resolved santosh.sahoo


    I want to display only some specified posts in the home page , instead of all posts.

    I have the id of all the post that i want in the home page.

    How do i do it with wp_query or query_post(); ?

    By using the following code , i am getting the result but the gallery does not comes in the posts.
    Have a look.

    function exclude_category( $query ) {
        if ( $query->is_home ) {
        return $query;
    add_filter( 'pre_get_posts', 'exclude_category' );

    The above code works , but i cannot understand why the gallery doesnt shows up.

    Any correction or suggestion would be wonderful..

    Thank you.

  • The topic ‘How do i filter posts in Home page.’ is closed to new replies.