0

This question already has an answer here:

i've tried to change the logo link in the homepage with this code i've found:

<?php echo esc_url( home_url( '/home' ) ); ?>

this in the header.php but doesn't work, also i tried

add_filter( 'login_headerurl', 'custom_login_logo_url' );function custom_login_logo_url($url) {
return '/home';}

doesn't work.

Thanks

marked as duplicate by Community Apr 1 at 10:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Hey Andrea :) Please check the question thread @leymannx linked to, specifically this answer by Jack Johansson. – jsmod Mar 29 at 21:03
  • Thanks guys, i tried to add this code function mb_login_url() { return home_url('/home'); } add_filter( 'login_headerurl', 'mb_login_url' ); but it doesn't work, maybe I made some mistakes? – Andrea Capretti Mar 29 at 21:53
  • Where are you adding it? It should be in functions.php, a file linked therein, or a plug-in --- not in a template file. – tmdesigned Mar 29 at 22:47
  • Yes, I added the code in my functions.php in the child theme – Andrea Capretti Mar 29 at 23:21
1

The example code you've posted, as the documentation states, "Filters link URL of the header logo above login form" (emphasis mine). However, you are asking about changing the URL for the site logo (which I assume is somewhere in the header of every page).

Normally this is done via the theme customizer. Depending on the theme, however, this feature may or may not be implemented. In the twentynineteen theme, in the template template-parts/header/site-branding.php on line 13 you can see where the logo is printed: <div class="site-logo"><?php the_custom_logo(); ?></div>. The function the_custom_logo() includes all the HTML necessary to display the site logo and link.

Assuming you are using twentynineteen as the parent theme, you would need to do the following:

  1. Copy header.php from the parent twentynineteen theme into the root of your child theme
  2. Create a new folder in your child theme called template-parts
  3. Create a new folder inside template-parts called header
  4. Copy the file site-branding.php from the parent theme (in template-parts/header) into your child theme in the same location.
  5. Modify lines 12 through 14 of site-branding.php as needed (remove the existing lines 12 through 14 and add the A and IMG elements for the logo)

Again, the exact method for how you should do it depends entirely on the the theme you are using.

--- Edited 2019-04-01 ---

I don't know what version of the Kalium theme you use nor if you are using the premium version but I did find a version online and it has a kalium_logo_url filter. Assuming this filter is present in your theme, if you add the following to the child functions.php file, it should do what you are intending:

add_filter( 'kalium_logo_url', function() {
   return '/home'; 
});

Please, if this solves your issue, mark this as the answer.

  • I think I understand. You want the experience to be: 1. User goes to site 2. Site shows landing page 3. User clicks (something, the logo perhaps) to make landing page go away 4. Site shows /home Although there are plugins that may do this, I've updated my answer with a solution that may or may not work for you. BTW, I see that this is a premium theme. Premium themes come with technical support. Have you contacted the theme developers for help with this issue? – Ted Stresen-Reuter Apr 1 at 9:52
  • Thank you Ted, your solution is working. – Andrea Capretti Apr 1 at 10:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.