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\'[重複]