[英]Adjust header.php
一位客户要求我用在header.php中设计的徽标来切换网站标题。 我一直在阅读有关儿童主题的信息,但我所了解的上下文不足以明确实施更改。
代码是:
<header id="masthead" class="site-header" role="banner">
<hgroup>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</hgroup>
<nav id="site-navigation" class="main-navigation" role="navigation">
<button class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></button>
<a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?></a>
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
</nav><!-- #site-navigation -->
<?php if ( get_header_image() ) : ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php header_image(); ?>" class="header-image" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" /></a>
<?php endif; ?>
</header>`
我只需要用徽标替换站点标题即可。 有指导吗?
我还需要导入图像,我会使用FTP吗? 保存图像的位置是否有限制?
我对wordpress不太了解。 但是,这可能有效,
<header id="masthead" class="site-header" role="banner">
<hgroup>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php bloginfo('template_directory'); ?>/images/imagename.png" alt="" width="xxx" height="xxx" /></a></h1>
因此,基本上我所做的是,我替换了<?php bloginfo( 'name' ); ?>
<?php bloginfo( 'name' ); ?>
从代码的第三行到<img src="<?php bloginfo('template_directory'); ?>/images/imagename.png" alt="" width="xxx" height="xxx" />
。 请用正确的值替换“ template_directory”和“ xxx”。
https://wordpress.org/support/topic/images-within-wordpress-theme-files
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.