Friday, April 3, 2020

2 ways to change the logo link in the header

When we have been navigating a page for a while, we instinctively click on the logo to return to the main page. However, some projects require that this link not go to the same page but to a different one. For example, if you sell a product or service you may want to click on the logo, the user is redirected to a landing page and increase the likelihood of conversion.

How will we do this? Today we teach you in different ways and an extra tip!

Via PHP file

It is super important that you work on a child theme to avoid that an error may affect your main theme or be lost when updating the theme.

First, you must place the following code in your header.php file:

Replace that code with the following one, placing your current URL where it says “Insert your URL here”.

Open the link in another tab

If you want the link to your logo to open in another tab, copy this code instead of the previous one and remember to replace the text that says “INSERT YOUR URL HERE” for the URL you want.

Via jQuery in the Divi theme options

First let’s learn how to add JavaScript or jQuery to our theme.

You must enter the Integration tab of the Theme Options in Divi. At the end of the options you will see a field called “Add code in the <header> of your blog”, it is made to place HTML but you can place JavaScript or jQuery in the following way by adding <script> at the beginning and </ script> at the end of code.

Remove the link logo completely

If you want to completely disable the link in the logo, add the following code.

Change the logo link to another page

You can change the logo link to a different page on the main page with this code, changing “google” to the URL you need:

Extra tip

With the following code, a pop up window of 500×500 will open, you only have to replace “google” with the URL you want.

How about these tips? See you in the next post!

Jefferson Maldonado
the authorJefferson Maldonado
UX WordPress Designer
Ux & Web Designer. Portafolio: Divi Blogger, WordPress Expert, UX Designer, Business Consultant.

Leave a Reply