Php Wordpress中出现意外的T_字符串
对于这个非常常用的Wordpress代码(循环),我得到了一个意外的T_字符串错误,这是到目前为止文件中唯一的php代码。问题行是Php Wordpress中出现意外的T_字符串,php,wordpress,loops,Php,Wordpress,Loops,对于这个非常常用的Wordpress代码(循环),我得到了一个意外的T_字符串错误,这是到目前为止文件中唯一的php代码。问题行是while行,这意味着if行不知何故被卷入其中 <?php if (have_posts()): while (have_ posts()) : the_ post() ?> <a href="<?php the_ permalink(); ?>"><?php the_title(); ?><
while
行,这意味着if
行不知何故被卷入其中
<?php
if (have_posts()):
while (have_ posts()) : the_ post()
?>
<a href="<?php the_ permalink(); ?>"><?php the_title(); ?></a>
<br>
<?php
the_content();
endwhile;
endif;
?>
我是一个php新手,所以我肯定我在这里遗漏了一些明显的东西。你可能在
have_u.posts()
,the_u.post()
和the_u.permalink()
中有一个额外的空间have_u.posts()
,the_u.post()
和the_u.permalink()
您调用的是的
,而不是的
,后者后面还需要一个分号:
while( have_posts() ) : the_post();
我看到你在have_uu\posts()
和中也犯了同样的错误
此外,还有一个专为WordPress online提供的StackExchange网站,您可能会发现该网站在处理WP项目时特别有用。您调用的是the u post()
,而不是the u post()
,后者还需要后跟分号:
while( have_posts() ) : the_post();
我看到你在have_uu\posts()
和中也犯了同样的错误
此外,还有一个专门为WordPress online提供的StackExchange网站,您可能会发现该网站在处理WP项目时特别有用。您在以下位置的不合适位置有一些空间:
while (have_ posts()) : the_ post()?> //should be have_posts() & the_post()
<a href="<?php the_ permalink(); ?>" //should be the_permalink()
while(have_uposts()):the_upost()?>//应该是have_posts()&the_post()
您在以下位置的不合适位置有一些空间:
while (have_ posts()) : the_ post()?> //should be have_posts() & the_post()
<a href="<?php the_ permalink(); ?>" //should be the_permalink()
while(have_uposts()):the_upost()?>//应该是have_posts()&the_post()
在我看来,这比php更像python。在我看来,这比php更像python。就是这样。真不敢相信我错过了!就这样。真不敢相信我错过了!