• Resolved WOWTALKS

    (@wowtalks)


    Hi there,

    I’m trying to change the url that the logo links to in the header. I’m using Velux / Primer theme. Not sure where the relevant code is located. Any help would be appreciated.

    Thanks!

    James

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @wowtalks,

    I’ve followed up with your request on our Github issue tracker:
    https://github.com/godaddy/wp-primer-theme/issues/256

    So others also have a solution, I’ll go ahead and post that response here:

    If you are attempting to update the URL to where the image is pointing to (eg: The end location when the site logo is clicked), then you can use the following code snippet and define your own custom URL.

    /**
     * Filter the custom logo, and add a custom URL.
     *
     * @return string       Custom site logo markup.
     */
    function primer_custom_logo_url() {
    
    	return sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
    		esc_url( 'https://www.google.com' ),
    		wp_get_attachment_image( get_theme_mod( 'custom_logo' ), 'full', false, array(
    			'class' => 'custom-logo',
    		) )
    	);
    
    }
    add_filter( 'get_custom_logo', 'primer_custom_logo_url' );

    What you’ll want to do is add that to a custom MU plugin and add the above code snippet to it. We have some documentation setup on how to create a custom MU plugin for your site: https://godaddy.github.io/wp-primer-theme/tutorials-and-examples/tutorials/mu-plugin.html

    Evan

    Thread Starter WOWTALKS

    (@wowtalks)

    Thanks Evan!

    I’ll give that a go.

    Best,

    James

    Thread Starter WOWTALKS

    (@wowtalks)

    Hi Evan,

    That worked. Thanks V much.

    Best,

    James

    Perfect! No problem at all. Have a great weekend.

    Evan

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change href of the logo’ is closed to new replies.