出于某种原因,我的编辑给了我一个错误<?php endwhile; ?>
,我不知道为什么。它说它是syntax error
。如果有人可以花时间检查我的代码,看看它是否是编辑器中的错误,或者我做错了什么,那将非常感激!
编辑:::::页面不会加载我发布了下面的错误图片...
提前致谢!
<div class="homepage-slider-container">
<div class="homepage-slider">
<?php $loop = new WP_Query(array('post_type' => 'feature', 'posts_per_page' => -1, 'orderby'=> 'ASC')); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<a href="#" class="prev"><img src="<?php echo get_template_directory_uri(); ?>/img/slide-left-arrow.png" alt=""></a>
<a href="#" class="next"><img src="<?php echo get_template_directory_uri(); ?>/img/slide-right-arrow.png" alt=""></a>
<div class="slide">
<?php $url = get_post_meta($post->ID, "url", true);
if($url!='') {
echo '<a href="'.$url.'">';
echo '
?>
<div class="homepage-slider-title">
<span class="title-rectangle">
<article>
<h3><?php the_title(); ?></h3>
<div class="clear"><!-- Clear --></div>
<p><?php the_content();?></p>
</article>
</span>
<!-- This is the right arrow that is attached to the title rectangle -->
<div class="title-rectangle-right_arrow"> </div>
<!-- This is the arrow that is to the right of the title text area -->
<img src="<?php echo get_template_directory_uri(); ?>/img/slider-title-right-arrow.gif" class="title-rectangle-further_right_arrow" alt="">
<?php '; echo the_post_thumbnail('full');
echo '</div>';
echo '</div>';
?>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
<div class="homepage-slider-front_pedestal">
<p><?php echo of_get_option('slider_front-pedestal', 'no entry'); ?></p>
</div>
</div>
</div>
答案 0 :(得分:0)
以下是完整版本:
<div class="homepage-slider-container">
<div class="homepage-slider">
<?php $loop = new WP_Query(array('post_type' => 'feature', 'posts_per_page' => -1, 'orderby'=> 'ASC')); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<a href="#" class="prev"><img src="<?php echo get_template_directory_uri(); ?>/img/slide-left-arrow.png" alt=""></a>
<a href="#" class="next"><img src="<?php echo get_template_directory_uri(); ?>/img/slide-right-arrow.png" alt=""></a>
<div class="slide">
<?php $url = get_post_meta($post->ID, "url", true);
if($url!='') {
echo '<a href="'.$url.'">';
?>
<div class="homepage-slider-title">
<span class="title-rectangle">
<article>
<h3><?php the_title(); ?></h3>
<div class="clear"><!-- Clear --></div>
<p><?php the_content();?></p>
</article>
</span>
<!-- This is the right arrow that is attached to the title rectangle -->
<div class="title-rectangle-right_arrow"> </div>
<!-- This is the arrow that is to the right of the title text area -->
<img src="<?php echo get_template_directory_uri(); ?>/img/slider-title-right-arrow.gif" class="title-rectangle-further_right_arrow" alt="">
<?php echo the_post_thumbnail('full'); ?>
</div>
<?php } ?>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
<div class="homepage-slider-front_pedestal">
<p><?php echo of_get_option('slider_front-pedestal', 'no entry'); ?></p>
</div>
</div>
</div>
答案 1 :(得分:0)
尝试使用:
<div class="homepage-slider-container">
<div class="homepage-slider">
<?php $loop = new WP_Query(array('post_type' => 'feature', 'posts_per_page' => -1, 'orderby'=> 'ASC')); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<a href="#" class="prev"><img src="<?php echo get_template_directory_uri(); ?>/img/slide-left-arrow.png" alt=""></a>
<a href="#" class="next"><img src="<?php echo get_template_directory_uri(); ?>/img/slide-right-arrow.png" alt=""></a>
<div class="slide">
<?php $url = get_post_meta($post->ID, "url", true);
if($url!='') {
echo '<a href="'.$url.'">';
?>
<div class="homepage-slider-title">
<span class="title-rectangle">
<article>
<h3><?php the_title(); ?></h3>
<div class="clear"><!-- Clear --></div>
<p><?php the_content();?></p>
</article>
</span>
<!-- This is the right arrow that is attached to the title rectangle -->
<div class="title-rectangle-right_arrow"> </div>
<!-- This is the arrow that is to the right of the title text area -->
<img src="<?php echo get_template_directory_uri(); ?>/img/slider-title-right-arrow.gif" class="title-rectangle-further_right_arrow" alt="">
<?php echo the_post_thumbnail('full');
echo '</div>';
echo '</div>';
?>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
<div class="homepage-slider-front_pedestal">
<p><?php echo of_get_option('slider_front-pedestal', 'no entry'); ?></p>
</div>
</div>
</div>
你有一个错误的回声,它不会回应任何东西。拿出一些单引号+回声/分号。
当您关闭PHP标记时,它不再回显,它正在使用普通的HTML。 :)所以在关闭PHP标记之前不需要回显。