The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] How do i filter posts in Home page. (1 post)

  1. santosh.sahoo
    Posted 5 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic