Php 如果语句不工作,则结束wordpress
我正在操纵数据以在显示时切换位置。数据位于if结构上。我认为数据分为三类,四类,日期和标题。当前的结构是类别、日期和标题。我想把它改成日期、标题和类别。但是我有一些错误 PHP代码:Php 如果语句不工作,则结束wordpress,php,wordpress,Php,Wordpress,我正在操纵数据以在显示时切换位置。数据位于if结构上。我认为数据分为三类,四类,日期和标题。当前的结构是类别、日期和标题。我想把它改成日期、标题和类别。但是我有一些错误 PHP代码: <?php if ( $displays_date ) { ?> <time class="entry-date published" datetime="<?php the_time( 'c' ); ?>"><?php the_t
<?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”
尝试替换右括号上的“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 } ?>
<?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 } ?>