【发布时间】:2016-08-03 15:58:30
【问题描述】:
我正在尝试将我的 Wordpress 徽标链接更改为自定义链接。
假设我要设置的新链接是http://newlink.html
我正在使用带有 25 个主题的 wordpress 4.5.3。 (所以我在 Stack 上找到的最后一个答案已经过时,因为自定义徽标在 4.5 中发生了变化)。
我进入header.php发现:
twentyfifteen_the_custom_logo();
if ( is_front_page() && is_home() ) : ?>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"
rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<?php else : ?>
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"
rel="home"><?php bloginfo( 'name' ); ?></a></p>
<?php endif;
所以如果我理解正确,我会为我的自定义徽标调用函数twentyfifteen_the_custom_logo();,接下来的两个链接不会影响我,因为它们是如果我仍在使用文本徽标,我没有。
然后我去寻找这个twentyfifteen_the_custom_logo(); 并找到了一些我可以更改的参数:
function.php:
/*
* Enable support for custom logo.
*
* @since Twenty Fifteen 1.5
*/
add_theme_support( 'custom-logo', array(
'height' => 248,
'width' => 248,
'flex-height' => true,
) );
所以我有了添加类似'src' => http://newlink.html, 的想法,但documentation 看起来不像接受这个参数。
我继续寻找功能并到达template-tags.php并找到:
if ( ! function_exists( 'twentyfifteen_the_custom_logo' ) ) :
/**
* Displays the optional custom logo.
*
* Does nothing if the custom logo is not available.
*
* @since Twenty Fifteen 1.5
*/
function twentyfifteen_the_custom_logo() {
if ( function_exists( 'the_custom_logo' ) ) {
the_custom_logo();
}
}
endif;
这个函数调用了我在任何地方都找不到的the_custom_logo();。
我可能错过了一些东西,或者我看起来不正确,如果你能帮助我找到如何将我的自定义徽标链接更改为我的自定义 url,那就太好了 :)
谢谢!
【问题讨论】: