WordPress.org

Ready to get started?Download WordPress

Forums

Testimonials by Aihrus
[resolved] Categories not working (2 posts)

  1. andrewk714
    Member
    Posted 1 year ago #

    Hello,

    I am working on a website for someone, and when I put in some testimonials, with categories. When I go to manage my categories and click on the "View" link under the category name, it sends me to a page that says:

    Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.


    Here is a link to one of the testimonials.

    Please let me know what I am doing wrong.

    http://wordpress.org/extend/plugins/testimonials-widget/

  2. Michael Cannon
    Member
    Plugin Author

    Posted 1 year ago #

    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;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic