在header.php中循环导致h1消失

时间:2019-05-19 15:47:01

标签: php wordpress

当我添加以下elseif时,如果我的循环似乎在错误的位置关闭并且显示h1(条目标头)的代码从页面中排除了

<?php   elseif ( is_page(25) ) : 
?>
 <div class="mobile-header"> <img src="/images/mobile-header.jpg" width="1080" height="1000" alt="Sean Sheehan" /> </div>

<?php  if  ( function_exists( 'soliloquy' ) )  { soliloquy( 'photography-dark', 'slug' ); } ?>

到我的header.php

这是包含修订的代码:

<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'twentynineteen' ); ?></a>
           
    <header id="masthead" class="<?php echo is_singular() && twentynineteen_can_show_post_thumbnail() ? 'site-header featured-image' : 'site-header'; ?>">

        <div class="site-branding-container">
            <?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
        </div><!-- .layout-wrap -->

        <?php if ( is_singular() && twentynineteen_can_show_post_thumbnail() ) : ?>
            <div class="site-featured-image">
                <?php
                    twentynineteen_post_thumbnail();
                    the_post();
                    $discussion = ! is_page() && twentynineteen_can_show_post_thumbnail() ? twentynineteen_get_discussion_data() : null;
                    $classes = 'entry-header';
                    if ( ! empty( $discussion ) && absint( $discussion->responses ) > 0 ) {
                        $classes = 'entry-header has-discussion';
                    }
                ?>
                <div class="<?php echo $classes; ?>">
                    <?php get_template_part( 'template-parts/header/entry', 'header' ); ?>
                </div><!-- .entry-header -->

我不知道循环是否在错误的位置关闭,但是当elseif语句为true并且我在第25页时,不会呈现H1标签。这段代码没有出现在页面的源代码中。

0 个答案:

没有答案