从OP的编辑中提取问题
已解决。。。有点
我添加了其他$query->set参数,它似乎适用于归档列表
/*CUSTOM ARCHIVE FOR EVENTS*/
function events_pagesize( $query ) {
// exit out if it\'s the admin or it isn\'t the main query
if ( is_admin() || ! $query->is_main_query() )
return;
// so its not admin, and its the main query, is it the tr-events post archive?
if ( is_post_type_archive( \'tr-events\' ) ) {
// it is!! Set the posts_per_page to 6
$query->set( \'posts_per_page\', 4 );
$query->set( \'order\' , \'asc\' );
$query->set( \'meta_key\', \'wpcf-tr-order-date\');
$query->set( \'orderby\', \'meta_value\');
return;
}
}
add_action( \'pre_get_posts\', \'events_pagesize\', 1 );
虽然不理想,但对于其他页面模板,这适用于自定义帖子类型存档页面。