2016-11-12 7 views
0

私はワードプレスのカスタム投稿の最初の投稿に追加のクラスを追加しようとしています。私はテンプレートの部分に次のコードを使用しています。エラーを示しています。最初のワードプレスカスタム投稿にクラスを追加する方法

Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\e24xp\wp-content\themes\e24x\testimonial.php on line 19

<?php   
    $args = array('post_type' => 'cc_testimonial', 'posts_per_page' => 1, "order" => "DESC"); 
    $query = new WP_Query($args); 
    $cc = count($query); 
    if ($query->have_posts()) { 
    $i=0; 
    while ($query->have_posts()) { 
    $query->the_post(); 
    <div class="testimonialitem item <?php echo ($i==0)?'active':''; ?>">//SHOWING ERROR 
        <div class="testimonial-content"> 
         <p><?php the_title();?></p> 
        </div>       
       </div><!--/.testimonialitem-->  
     $i++; 
     } 
    } 
    wp_reset_query(); 
    wp_reset_postdata(); 
    ?> 

は、このコードで何が間違っています?

答えて

0

あなたは聞いて喜んHTML

<?php   
$args = array('post_type' => 'cc_testimonial', 'posts_per_page' => 1, "order" => "DESC"); 
$query = new WP_Query($args); 
$cc = count($query); 
if ($query->have_posts()) { 
$i=0; 
while ($query->have_posts()) { 
$query->the_post(); 

// need to close PHP here ?> 

<div class="testimonialitem item <?php echo ($i==0)?'active':''; ?>"> <!-- this is Html comment SHOWING ERROR --> 
       <div class="testimonial-content"> 
        <p><?php the_title();?></p> 
       </div>       
      </div><!--/.testimonialitem-->  

<?php // and open it here again 
    $i++; 
    } 
} 
wp_reset_query(); 
wp_reset_postdata(); 
?> 
+0

@SBiswasを書き込む前PHPを閉じるのを忘れて!あなたは歓迎です、幸せなコーディング – caramba

関連する問題