解析错误:语法错误,第187行header.php中的文件意外结束
我在解析错误:语法错误,第187行header.php中的文件意外结束,php,Php,我在header.php文件中遇到了这个问题 解析错误:语法错误,第187行的header.php中出现意外的文件结尾 这是代码,任何人都可以告诉我语法缺失的地方 <?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail("featured", array("class" => "alignleft
header.php
文件中遇到了这个问题
解析错误:语法错误,第187行的
header.php
中出现意外的文件结尾
这是代码,任何人都可以告诉我语法缺失的地方
<?php
if ( has_post_thumbnail() ) {
// check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail("featured", array("class" => "alignleft"));
?>
您忘记关闭了
}
<?php
if (has_post_thumbnail()) {
the_post_thumbnail("featured", array(
"class" => "alignleft"
));
}
?>
缺少}
<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail("featured", array("class" => "alignleft"));
}
endwhile;
endif;
}
?>
文件中缺少两个大括号
<?php if(is_front_page()){ ?> // one closing brace `}` missing for this if condition. **give spaces here**...
if ( has_post_thumbnail() ) { // one closing brace `}` for this if condition
//此if条件缺少一个右大括号`}`**在这里给空格**。。。
if(具有_post _thumbnail()){//此if条件的一个右大括号`}`
所以在你们的页面末尾你们必须加上两个大括号。按如下方式更新代码:
<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail("featured", array("class" => "alignleft"));
}
}
?>
query_posts(array("category_name" => "Home Slider" , "post_per_page" => -1, "showposts" => -1 , "post_type" => "post"));
if(have_posts()): endif; /// add here endif;
while(have_posts()): the_post(); endwhile; /// add here endwhile;
查询帖子(数组(“类别名称”=>“主页滑块”、“每页帖子”=>-1、“展示帖子”=>-1、“帖子类型”=>“帖子”));
if(have_posts()):endif;//在此添加endif;
while(have_posts()):the_post();endwhile;///在此处添加endwhile;
您在if条件下打开了{
但}
大括号在哪里?我添加了这个,但它不工作。您的函数包含什么?我如何发送完整文件?尽可能使用编辑按钮;文件有多大?@johnsmith仍然存在语法错误?代码完全有效。是的,仍然是语法错误,只有行号更改。请将完整文件发送给我。我会调查的。可能需要使用如何发送完整文件@johnsmithpost其他代码…我如何在这里发布完整文件?从第187行到第187行,请查看完整文件更新答案,但您的header.php代码不完整。arse错误:语法错误,意外的“}”输入请在此语句中留出空间
,然后检查。感谢您的帮助,但它不起作用。现在请检查我的更新答案。非常感谢您的帮助,但它仍然显示相同的错误