• How to Show Posts of Custom Post Types on WordPress Home Page?

    if ( ! function_exists( 'pinboard_filter_query' ) ) :
    /**
     * Filter the main loop
     *
     * Allows overriding of query parameters
     * for the main loop without performing
     * additional database queries
     *
     * @since Pinboard 1.0
     */
    function pinboard_filter_query( $query ) {
    	global $wp_the_query;
    	if( $wp_the_query === $query ) {
    		if( $query->is_home() && pinboard_get_option( 'slider' ) )
    			$query->set( 'ignore_sticky_posts', 1 );
    		if( $query->is_home() && pinboard_get_option( 'blog_exclude_portfolio' ) )
    			$query->set( 'cat', '-' . pinboard_get_option( 'portfolio_cat' ) );
    	}
    }
    endif;
    
    add_action( 'pre_get_posts', 'pinboard_filter_query' );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to Show Posts of Custom Post Types on WordPress Home Page?’ is closed to new replies.