• Is it possible to edit the link to which the site logo goes when clicked? I’d like to be able to set this to a main hub site URL.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @awlang,

    Add the below code in your child theme’s functions.php.

    function my_custom_logo_link() {
    
    	// The logo
    	$custom_logo_id = get_theme_mod( 'custom_logo' );
    
    	// If has logo
    	if ( $custom_logo_id ) {
    
    		// Attr
    		$custom_logo_attr = array(
    			'class'    => 'custom-logo',
    			'itemprop' => 'logo',
    		);
    
    		// Image alt
    		$image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true );
    		if ( empty( $image_alt ) ) {
    			$custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' );
    		}
    
    		// Get the image
    		$html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
    			esc_url( 'https://rescen.net/' ),
    			wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr )
    		);
    
    	}
    
    	// Return
    	return $html;
    }
    add_filter( 'get_custom_logo', 'my_custom_logo_link' );

    I’m assuming that you are technically sound for this answer.

    Regards,
    Milan.

    Thread Starter awlang

    (@awlang)

    Many thanks Milan, that’s worked a treat!

    Andrew

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Site logo link’ is closed to new replies.