I am trying to change my Wordpress logo link into some custom one.
Let's say the new link i want to set is http://newlink.html
I am using wordpress 4.5.3 with twenty fifteen theme. ( so the last answer i fount on Stack is outdated because the custom logo changed in 4.5 ).
I went in header.php
and found :
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;
So if i get it correctly, i'm calling a function twentyfifteen_the_custom_logo();
for my custom logo and the next two links does not affect me because they are if i still was using the text logo, which I dont.
I then went hunting for this twentyfifteen_the_custom_logo();
and found some parameters I could change :
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,
) );
So I got the idea to add something like 'src' => http://newlink.html,
but the documentation does not look like accepting this parameter.
I continue my hunting to find the function and get to template-tags.php
and find :
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;
This function calls the_custom_logo();
that I can't find anywhere.
I may have missed something or maybe I didn't look the right way, if you could help me finding how to change my custom logo link to my custom url, it would be wonderful :)
Thanks !
Add WordPress filter to change custom logo link as like.
Add in your
functions.php
file.http://screencast.com/t/z19OejeBK