• Resolved santosh.sahoo

    (@santoshsahoo)


    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 ) {
    
    	$ids=get_option("Fpost_list");
        if ( $query->is_home ) {
           	 $query->query_vars["post__in"]=$ids;
        }
    
        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.