How do I include testimonies in my category or archive view
At the beginning of your theme’s functions.php
file, place code similar to the following for the configuration you need.
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' ) ); } return $query; }