我为我的代码保持错误“解析错误:语法错误,第13行意外的文件结尾”...如下所示
<?php
$all= get_posts(array('post_type' => 'books', 'numberposts' => -1,));
foreach ( $all as $post ) : setup_postdata($post);
if (!empty($post))
{
$postid=$post->ID;
echo $postid;
}
?>
答案 0 :(得分:5)
您忘了结束foreach
<?php
$all= get_posts(array('post_type' => 'books', 'numberposts' => -1,));
foreach ( $all as $post ) : setup_postdata($post);
if (!empty($post))
{
$postid=$post->ID;
echo $postid;
}
endforeach;
?>