This question already has answers here: Change logo url link (8 answers) Closed 6 years ago.admin管理员组文章数量:1026982
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
This question already has answers here: Change logo url link (8 answers) Closed 6 years ago.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
Share Improve this question asked Mar 29, 2019 at 16:55 Andrea CaprettiAndrea Capretti 632 silver badges6 bronze badges 4- Hey Andrea :) Please check the question thread @leymannx linked to, specifically this answer by Jack Johansson. – jsmod Commented Mar 29, 2019 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 Commented Mar 29, 2019 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 Commented Mar 29, 2019 at 22:47
- Yes, I added the code in my functions.php in the child theme – Andrea Capretti Commented Mar 29, 2019 at 23:21
1 Answer
Reset to default 1The 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:
- Copy header.php from the parent twentynineteen theme into the root of your child theme
- Create a new folder in your child theme called template-parts
- Create a new folder inside template-parts called header
- Copy the file site-branding.php from the parent theme (in
template-parts/header
) into your child theme in the same location. - 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.
This question already has answers here: Change logo url link (8 answers) Closed 6 years ago.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
This question already has answers here: Change logo url link (8 answers) Closed 6 years ago.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
Share Improve this question asked Mar 29, 2019 at 16:55 Andrea CaprettiAndrea Capretti 632 silver badges6 bronze badges 4- Hey Andrea :) Please check the question thread @leymannx linked to, specifically this answer by Jack Johansson. – jsmod Commented Mar 29, 2019 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 Commented Mar 29, 2019 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 Commented Mar 29, 2019 at 22:47
- Yes, I added the code in my functions.php in the child theme – Andrea Capretti Commented Mar 29, 2019 at 23:21
1 Answer
Reset to default 1The 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:
- Copy header.php from the parent twentynineteen theme into the root of your child theme
- Create a new folder in your child theme called template-parts
- Create a new folder inside template-parts called header
- Copy the file site-branding.php from the parent theme (in
template-parts/header
) into your child theme in the same location. - 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.
本文标签: Change homepage39s logo link
版权声明:本文标题:Change homepage's logo link 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745640557a2160719.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论