WordPress.org

Ready to get started?Download WordPress

Forums

P2
[resolved] Exclude particular post_formats from the Home Page (2 posts)

  1. valuser
    Member
    Posted 10 months ago #

    How could a (or some) post format(s) be excluded from the front page of p2 theme ?

    Have tried the following but not successful.

    function exclude_postformat($query) {
        if ( $query->is_home ) {
    
    	// Array of post formats to exclude, by slug
    		$post_formats_to_exclude = array(
    			'status',
    			'quote',
    			'link'
    		);
    
                array(
                    'taxonomy' => 'post_format',
                    'field' => 'slug',
                    'terms' => $post_formats_to_exclude,
                    'operator' => 'NOT IN'
                );
        }
        return $query;
    }
    add_filter('pre_get_posts', 'exclude_postformat');

    Any ideas most welcome.

  2. valuser
    Member
    Posted 10 months ago #

Reply

You must log in to post.

About this Theme

About this Topic