检查您的post\\u类型是否准确listings
而不是listing
. 还要检查这种方法:
<?php
function filter_where( $where = \'\' ) {
$where .= " AND post_date > \'2009-03-01\'";
return $where;
}
add_filter( \'posts_where\', \'filter_where\' );
function parse_wp_query( $query ) {
$query->set( \'post_type\', array( \'listings\' ) );
return $query;
}
add_filter( \'parse_query\', \'parse_wp_query\' );
$posts = query_posts( \'posts_per_page=-1&post_type=listings\' );
remove_filter( \'posts_where\', \'filter_where\' );
remove_filter( \'parse_query\', \'parse_wp_query\' );
echo \'<ol>\';
foreach ($posts as $post) {
echo \'<li>\' . get_the_title() . \'</li>\';
}
echo \'</ol>\';
?>