【问题标题】:Display the page title in header - Wordpress在页眉中显示页面标题 - Wordpress
【发布时间】:2016-01-06 15:17:03
【问题描述】:

我需要为标题图片添加标题,或者更确切地说添加适当的网站标题。

我需要在普通页面的标题图像中添加页面标题,而在首页不会显示页面标题(因为有 SVG 徽标)。这是我从“content-header.php”中获取的代码:

// Display the image and text
    ?>
    <header class="content-header-image">
        <div class="<?php echo $image_class; ?>" style="background-image: url('<?php echo $image_url; ?>')">
            <div class="<?php echo $overlay_class; ?>">
            <h1 class="header-image-title"><?php echo $title; ?></h1>
            <?php if ( $subtitle ) echo '<h2 class="header-image-caption">' . $subtitle . '</h2>'; ?>
            <?php if ( $description ) echo '<p class="header-image-description">' . $description . '</p>'; ?> 

            <?php               
            // Only for static home page, show a scroll down icon
            if ( is_front_page() ) {
                echo '<div class="spacer"></div>';
                echo '<a href="#pagetop" class="scroll-down smoothscroll"><span class="glyphicon glyphicon-chevron-down"></span></a>';
            }
            ?>

            </div><!-- .cover-image-overlay or .section-image-overlay -->
        </div><!-- .cover-image or .section-image -->
    </header><!-- content-header-image -->

【问题讨论】:

    标签: php html css wordpress header


    【解决方案1】:

    你可以使用 &lt;h1&gt;&lt;?php bloginfo('name'); ?&gt;&lt;/h1&gt;

    【讨论】:

      【解决方案2】:

      你会想要使用你的

          if(is_front_page()){ what you have }
            else{ echo 'other content for other pages';}
      

      有条件地在主页上显示徽标并在所有其他页面上显示其他内容

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-06-25
        • 2011-08-09
        • 1970-01-01
        • 1970-01-01
        • 2014-03-13
        • 1970-01-01
        相关资源
        最近更新 更多