如何使用php和html一起编辑网页的标题


How to use php and html together to edit header of a webpage

我有以下来自wordpress主题的命令:

</head>
<body <?php body_class(); ?>>

<header id="masthead" class="site-header <?php echo ( get_theme_mod( 'panoramic-header-layout', 'panoramic-header-layout-standard' ) == 'panoramic-header-layout-centered' ) ? sanitize_html_class( 'panoramic-header-layout-centered' ) : sanitize_html_class( 'panoramic-header-layout-standard' ); ?>" role="banner">

<?php if ( get_theme_mod( 'panoramic-header-layout', 'panoramic-header-layout-standard' ) == 'panoramic-header-layout-centered' ) : ?>
    <?php get_template_part( 'library/template-parts/header', 'centered' ); ?>
<?php else : ?>
    <?php get_template_part( 'library/template-parts/header', 'centered' ); ?>
<?php endif; ?>

现在我需要添加两个徽标,一个在左边,另一个在右边。

怎么做?

如评论部分所述,只需将图标添加到HTML部分并删除特定于主题的图像。下面是一个示例,展示了如何做到这一点:

HTML部分:

<header>
  <img class="logo left" src="PATH_TO_LEFT_LOGO.png">
  <div class="header-text left">
    This may be a title.
  </div>
  <img class="logo right" src="PATH_TO_RIGHT_LOGO.png">
  <br class="header-clear" />
</header>

CSS来对齐logo文件:

.header-text {
  color: white;
  margin: 5px;
  font-size: 20px;
}
.header-text.left,
.logo.left{
  float: left;
}
.logo.right {
  float: right;
}
.header-clear {
  clear: both;
}

如果你不需要标题文本,从CSS部分删除DIV层和适当的规则。很明显,您必须替换与您的配置匹配的徽标图像的路径:-)