2012-04-20 5 views

答えて

2
$count_posts = wp_count_posts(); 
$future_posts = $count_posts->future; 
if($future_posts > 0) 
{ 
    // future posts available 
} 

または

if(wp_count_posts()->future > 0) 
{ 
    // future posts available 
} 

wp_count_posts()戻り

stdClass Object 
( 
    [Publish] => 60 
    [Future] => 1 // only one is available 
    [Draft] => 9 
    [Pending] => 3 
    [Private] => 0 
    [Trash] => 0 
    [Auto-draft] => 3 
    [Inherit] => 0 
) 

Reference

0

WordPressのコーデックスを参照してください:post_status塗りつぶしfuture

+1

これは右引数ですが、私はKoralekは 'future'、ない' draft'を使用する必要があると思います。 –

+0

@BorisBelenski、そうです、あなたは正しいです。 – Machiel

関連する問題