WordPress插件错误语法错误,意外\'endwhile\'[重复]
问题描述:
This question already has an answer here:
I\'ve migrated a website across from a cheapo deluxe host over to my AWS Lightsail instance. Now everything works until I go to this page. It worked OK on the old host but on lightsail it\'s not working at all. I just get the WordPress plugin Error syntax error, unexpected \'endwhile\' on line 87 error.
I\'ve tried everything I can think of and have spent a good few hours tinkering and Googling. I\'m sure im missing a single } or { somewhere
PHP isn\'t my strong point so any help would be greatly appreciated.
Code below is the original file, without my tinkering.
Thanks everyone!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
<?php get_header(); ?> <div id=\"page-header\"> <div class=\"container\"> <div class=\"row\"> <div class=\"col-lg-12\"> <header class=\"page-header\"> <h1>Meet the team</h1> </header><!-- .entry-header --> </div> </div> </div> </div> <!-- page-header --> <div id=\"content-container\" class=\"team\"> <div class=\"container\"> <div class=\"row\"> <div class=\"col-lg-12\"> <?php $projectloop = new WP_Query(array( \'paged\' => get_query_var(\'paged\'), \'post_type\' => \'meet-the-team\', \'paged\' => $paged, \'posts_per_page\' => 100, \'orderby\' => \'name\', \'order\' => \'ASC\', )); ?> <?php $count = 0; while ( $projectloop->have_posts() ) : $projectloop->the_post(); if ($count == 0 || ($count % 3 == 0)) { ?> <div class=\"row\"> <? } ?> <div class=\"col-lg-4 team-member\"> <?php if ( \'\' != get_the_post_thumbnail() ) {?> <?php echo get_the_post_thumbnail(get_the_ID(),\'team\',array(\'alt\' => get_the_title(),\'title\' => get_the_title())); ?> <?php } else { ?> <img class=\"image\" alt=\"<?php bloginfo(\'name\'); ?>\" src=\"<?php bloginfo(\'template_url\'); ?>/images/team-member-default.jpg\" alt=\"Face Dental\"> <?php } ?> <h2><a href=\"<?php the_permalink();?>\"><?php the_title();?></a></h2> <p class=\"job-title\"><?php the_field(\'job_title\'); ?></p> <?php if(get_field(\'speciality\')) { ?> <p>Special Interests: <?php the_field(\'speciality\'); ?></p> <?php } ?> <?php if(get_field(\'gdc_number\')) { ?> <p>GDC Number: <?php the_field(\'gdc_number\'); ?></p> <?php } ?> <p>Work days: <?php the_field(\'work_days\'); ?></p> <?php //the_excerpt ();?> </div> <?php $count++; if($count == 0 || ($count % 3 == 0)) { ?> </div> <?php } ?> <?php endwhile; // end of the loop. ?> <?php $big = 999999999; // need an unlikely integer echo \'<div class=\"pagination\">\'; echo paginate_links( array( \'type\' => \'list\', \'base\' => str_replace( $big, \'%#%\', esc_url( get_pagenum_link( $big ) ) ), \'format\' => \'?paged=%#%\', \'current\' => max( 1, get_query_var(\'paged\') ), \'total\' => $projectloop->max_num_pages, \'next_text\' => __(\'»\'), \'prev_text\' => __(\'«\'), ) ); ?></div> </div> </div> </div> </div> </div> <!-- content-container --> <?php get_footer(); ?> |
1 2 |
</div> |
网友观点:
line 41 <? } ?>
should be <?php } ?>
you can also just use {
to open while loop
instead of :
. Using :
in your case is little messed up since your php
is a mess with html
Also when looking at the while ( $projectloop->have_posts() )
this isn\'t a while
loop but rather if
statement
check this out http://php.net/manual/en/control-structures.while.php
Your while loop needs a statement while ($count <= 10) {
1. 带 [亲测] 说明源码已经被站长亲测过!
2. 下载后的源码请在24小时内删除,仅供学习用途!
3. 分享目的仅供大家学习和交流,请不要用于商业用途!
4. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
5. 本站所有资源来源于站长上传和网络,如有侵权请邮件联系站长!
6. 没带 [亲测] 代表站长时间紧促,站长会保持每天更新 [亲测] 源码 !
7. 盗版ripro用户购买ripro美化无担保,若设置不成功/不生效我们不支持退款!
8. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
9. 如果你也有好源码或者教程,可以到审核区发布,分享有金币奖励和额外收入!
10.如果您购买了某个产品,而我们还没来得及更新,请联系站长或留言催更,谢谢理解 !
GG资源网 » WordPress插件错误语法错误,意外\'endwhile\'[重复]