Support » Theme: P2 » Exclude particular post_formats from the Home Page

  • Resolved valuser

    (@valuser)


    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.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Exclude particular post_formats from the Home Page’ is closed to new replies.