admin管理员组文章数量:1387443
I need to change default WordPress get_custom_logo()
generated url because I need to link to the main multi-site site instead of single site. Is there any filter to change this function?
I need to change default WordPress get_custom_logo()
generated url because I need to link to the main multi-site site instead of single site. Is there any filter to change this function?
2 Answers
Reset to default 5I solved using this filter:
add_filter( 'get_custom_logo', 'custom_logo_url' );
function custom_logo_url ( $html ) {
$custom_logo_id = get_theme_mod( 'custom_logo' );
$url = network_site_url();
$html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
esc_url( $url ),
wp_get_attachment_image( $custom_logo_id, 'full', false, array(
'class' => 'custom-logo',
) )
);
return $html;
}
Here's an alternative solution:
function update_logo_url( $html ) {
$site_url = get_site_url();
return str_replace( $site_url, esc_url( 'https://your.url' ), $html );
}
add_filter( 'get_custom_logo', 'update_logo_url' );
本文标签: theme developmentHow to change getcustomlogo() url
版权声明:本文标题:theme development - How to change get_custom_logo() url? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744563296a2612895.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论