Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Rachel Goldstein

    (@rachelgoldstein71)

    I figured out that I needed to uncheck the “randomize” button in the settings that I thought was only for the rotator and not the archives page. Is there way to let the rotator be random while the archives are displayed in a specific order?

    Plugin Author Hal Gatewood

    (@halgatewood)

    Here is a code snippit you can play with:

    function hg_testimonial_rotator_order_archive( $query )
    {
    	if ( !is_admin() && $query->is_main_query() && $query->is_post_type_archive( "testimonial" ) )
    	{
    		$query->set( 'order', 'DESC' );
    		$query->set( 'order_by', 'menu_order' );
    	}
    	return $query;
    }
    
    add_filter( "pre_get_posts", "hg_testimonial_rotator_order_archive" );

    I believe the query->set part matches the same stuff you would do in a query_posts: https://codex.www.ads-software.com/Function_Reference/query_posts#Parameters

    Hope this helps,
    Hal

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Reorder Testimonials’ is closed to new replies.