笔记:修改wordpress注册登录logo和链接

worrdpress的登录页面很多时候都是固定的,无法调整。不过我们可以自己更改界面的logo和跳转地址。个人不喜欢使用插件,毕竟插件存在各种不可见的情况,我们的网站也不会没事儿老升级的,能用就行了。

1、更改图片

把下面代码放到/htdocs/wp-content/themes/主题文件夹,下面的functions.php中。我的主题functions.php预留了一个放个人代码的地方,很方便。
————————————————

// 去登录界面的默认图片
function custom_loginlogo() {
echo ‘<style type=”text/css”>
h1 a {background-image: url(‘.get_bloginfo(‘template_directory’).’/images/logo.png) !important;background-size: 265px !important;width:265px !important; }
</style>’;
}
add_action(‘login_head’, ‘custom_loginlogo’);

 

2、更改跳转链接

// 去链接
function custom_loginlogo_url($url) {
return’https://www.xuewangzhan.net/’; //在此输入你需要链接到的URL地址
}
add_filter( ‘login_headerurl’, ‘custom_loginlogo_url’);
function custom_register_url($url) {
return’https://www.xuewangzhan.net/’; //在此输入你需要链接到的URL地址
}
add_filter( ‘login_registerurl’, ‘custom_register_url’);

感谢分享,请注明出处:https://jp.cf162.com/803.html

笔记:修改wordpress注册登录logo和链接