如果语句不工作结束wordpress

问题描述:

我操纵数据来切换显示时的位置。数据在if结构上。数据分为三类,我认为类别,日期和标题。当前的结构是类别,日期和标题响应。我想将其更改为日期,标题和类别。但我有一些错误。如果语句不工作结束wordpress

PHP代码:

 <?php if ($displays_date) { ?> 
      <time class="entry-date published" datetime="<?php the_time('c'); ?>"><?php the_time(get_option('date_format')); ?></time> 
      <time class="updated" datetime="<?php the_modified_time('c'); ?>"><?php the_modified_time(get_option('date_format')); ?></time> 
     <?php } ?> 


     <?php if ($displays_cat) { ?> 
      <span class="entry-category"> 
       <?php the_category(', '); ?> 
      </span> 
     <?php } ?> 

     <?php if (! is_category()) { // Do not display category name in category pages ?> 
     <span class="entry-category"> 
      <?php the_category(', '); ?> 
     </span> 
     <?php } ?> 

     <?php 
     // Date 
     global $ti_option; 
     if ($ti_option['post_item_date'] == '1') : 
     ?> 
      <time class="entry-date published" datetime="<?php the_time('c'); ?>"><?php the_time(get_option('date_format')); ?></time> 
      <time class="updated" datetime="<?php the_modified_time('c'); ?>"><?php the_modified_time(get_option('date_format')); ?></time> 
     <?php endif; ?> 


     <?php content_post_item_title(); ?> 

试图做这样这样。它有关于endif的一些错误。

 <?php if ($displays_date) { ?> 
      <time class="entry-date published" datetime="<?php the_time('c'); ?>"><?php the_time(get_option('date_format')); ?></time> 
      <time class="updated" datetime="<?php the_modified_time('c'); ?>"><?php the_modified_time(get_option('date_format')); ?></time> 
     <?php } ?> 

     <?php 
     // Date 
     global $ti_option; 
     if ($ti_option['post_item_date'] == '1') : 
     ?> 
      <time class="entry-date published" datetime="<?php the_time('c'); ?>"><?php the_time(get_option('date_format')); ?></time> 
      <time class="updated" datetime="<?php the_modified_time('c'); ?>"><?php the_modified_time(get_option('date_format')); ?></time> 
     <?php endif; ?> 


     <?php content_post_item_title(); ?> 


     <?php if ($displays_cat) { ?> 
      <span class="entry-category"> 
       <?php the_category(', '); ?> 
      </span> 
     <?php } ?> 

     <?php if (! is_category()) { // Do not display category name in category pages ?> 
     <span class="entry-category"> 
      <?php the_category(', '); ?> 
     </span> 
     <?php endif; ?> 

我在我的WordPress网站上运行这个。

在代码的最后一块,你正在使用“ENDIF”

尝试更换“ENDIF”的闭架:

<?php if (! is_category()) { // Do not display category name in category pages ?> 
    <span class="entry-category"> 
     <?php the_category(', '); ?> 
    </span> 
<?php } ?> 

发现该if语句没有连接在一起,可以是移动而不更改任何代码。

 <?php if ($displays_date) { ?> 
      <time class="entry-date published" datetime="<?php the_time('c'); ?>"><?php the_time(get_option('date_format')); ?></time> 
      <time class="updated" datetime="<?php the_modified_time('c'); ?>"><?php the_modified_time(get_option('date_format')); ?></time> 
     <?php } ?> 

     <?php 
     // Date 
     global $ti_option; 
     if ($ti_option['post_item_date'] == '1') : 
     ?> 
      <time class="entry-date published" datetime="<?php the_time('c'); ?>"><?php the_time(get_option('date_format')); ?></time> 
      <time class="updated" datetime="<?php the_modified_time('c'); ?>"><?php the_modified_time(get_option('date_format')); ?></time> 
     <?php endif; ?> 


     <?php content_post_item_title(); ?> 

     <?php if ($displays_cat) { ?> 
      <span class="entry-category"> 
       <?php the_category(', '); ?> 
      </span> 
     <?php } ?> 

     <?php if (! is_category()) { // Do not display category name in category pages ?> 
     <span class="entry-category"> 
      <?php the_category(', '); ?> 
     </span> 
     <?php } ?>