Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如果语句不工作,则结束wordpress_Php_Wordpress - Fatal编程技术网

Php 如果语句不工作,则结束wordpress

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

我正在操纵数据以在显示时切换位置。数据位于if结构上。我认为数据分为三类,四类,日期和标题。当前的结构是类别、日期和标题。我想把它改成日期、标题和类别。但是我有一些错误

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”

尝试替换右括号上的“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 } ?>