Support » Plugin: Testimonials Widget » Categories not working

Viewing 1 replies (of 1 total)
  • Plugin Author Michael Cannon

    (@comprock)

    Great question, FAQ 52 will come soon.

    = 52. How do I include testimonies in my archive view? =

    add_filter( 'pre_get_posts', 'pre_get_posts_allow_testimonials' );
    function pre_get_posts_allow_testimonials( $query ) {
    	if ( $query->is_admin ) {
    		return $query;
    	} elseif ( ( $query->is_main_query() || is_feed() )
    		&& ! is_page()
    		&& ( ( ! empty( $query->query_vars['post_type'] ) && 'post' == $query->query_vars['post_type'] )
    			|| is_archive() )
    	) {
    		$query->set( 'post_type', array( 'post', Testimonials_Widget::pt ) );
    	}
    
    	return $query;
    }

Viewing 1 replies (of 1 total)
  • The topic ‘Categories not working’ is closed to new replies.