Pergunta

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

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a wordpress.stackexchange
scroll top