have_posts

函数


have_posts ( No parameters )
返回值
  • (bool) True if posts are available, false if end of the loop.
定义位置
  • wp-includes/query.php
    , line 940
引入
1.5.0
弃用

确定当前的WordPress查询是否有文章可供循环使用。

function have_posts() {
	global $wp_query;

	if ( ! isset( $wp_query ) ) {
		return false;
	}

	return $wp_query->have_posts();
}