「新着記事」にカスタム投稿タイプを含める

Ads

Code

<?php
function chample_latest_posts( $wp_query ) {
if ( is_home() && ! isset( $wp_query->query_vars['suppress_filters'] ) ) {
$wp_query->query_vars['post_type'] = array( 'post', 'foo', 'bar' );
}
}
add_action( 'parse_query', 'chample_latest_posts' );
?>
view raw gistfile1.aw hosted with ❤ by GitHub

Note

Description カスタム投稿の投稿を取得して新着に含める。アーカイブやタグページも必要ならis_category()やis_tag()を使う。
WordPress Ver. 3.3.1
Via WordPressの新着情報表示にカスタム投稿タイプを含める方法