3
我似乎無法找到語法錯誤。這裏是有問題的代碼:語法錯誤,意外'endforeach'
<div class='related_row'>
<?php
foreach($postList as $post):
setup_postdata($post);
?>
<div class='related_product'>
<?php if(has_post_thumbnail()) : ?>
<div class='related_image'>
<a class='service_overlay' href='<?php the_permalink(); ?>'></a>
<a class='service_page' href='<?php the_permalink(); ?>'><?php the_post_thumbnail(); ?></a>
</div>
<?php else: ?>
<div class='related_image'>
<a class='service_overlay' href='<?php the_permalink(); ?>'></a>
<a class='service_page' href='<?php the_permalink(); ?>'><img src="<?php get_bloginfo() ?>/wp-content/uploads/2013/08/header_image.png" alt='Service image' /></a>
</div>
<?php endif; ?>
<div class='related_title'>
<a href='<?php the_permalink(); ?>'><?php the_title(); ?></a>
</div>
</div>
<?php $counter++; ?>
<?php if($counter % 3 == 0 && $counter < $total): ?>
</div>
<div class='related_row'>
<? endif; ?>
<?php
endforeach;
wp_reset_postdata();
?>
</div>
我已經在這段代碼在過去20分鐘盯着似乎無法發現它。如果有人能指出,我會很感激。
你猜對了即期。不能相信我錯過了。我盯着同樣的代碼長達這麼久!謝謝!! – saunders
我會接受你的答案,當它讓我:) – saunders