Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); | |
?> |
Note
Description | カスタム投稿の投稿を取得して新着に含める。アーカイブやタグページも必要ならis_category()やis_tag()を使う。 |
---|---|
WordPress Ver. | 3.3.1 |
Via | WordPressの新着情報表示にカスタム投稿タイプを含める方法 |