メインクエリー変更
/* メインクエリー変更
------------------------------ */
function change_query( $query ) {
if ( !is_admin() && $query->is_main_query() ) {
if ( $query->is_post_type_archive('kuma_total') ) {
//page-attributesのorder順に並べ替え
$query->set('orderby','menu_order' );
$query->set('order','ASC' );
}
if ( $query->is_post_type_archive('tarumi_total') ) {
//page-attributesのorder順に並べ替え
$query->set('orderby','menu_order' );
$query->set('order','ASC' );
}
if ( $query->is_post_type_archive('knowledge') || $query->is_tax( 'cat_knowledge' ) ) {
$query->set('posts_per_page','5' );
}
if ( $query->is_tax('cat_knowledge') ) {
$sticky = get_option( 'sticky_posts' );
$query->set('post__not_in', $sticky );
}
}
}
add_action( 'pre_get_posts', 'change_query' );