That looks pretty good to me! Good work. Does it work for you? You can always use it to test for other pages, also, not just your chosen “front page,” by using
if ( is_page( 'slug' ) )
or
if ( is_page( 'ID' ) )
or
checking that it ISN’T a page like
if ( ! is_page( 'slug-of-page-i-do-not-want' ) )
The only change I’d make is
add_filter( 'get_custom_logo', 'my_alter_logo_fx', 10, 2 );
function my_alter_logo_fx( $html, $blog_id ) {
if ( is_front_page() ) {
// only define these variables if you need to (it's the front page)
$url = home_url('/');
$whitelogo = home_url( $path = 'images/logo_white.svg');
$html = sprintf(
'<a href="%1$s" class="custom-logo-link" rel="home"><img src="%2$s" class="custom-logo" alt="Logo white" height="28" width="125"></a>', $url , $whitelogo );
}
return $html;
}