functions.php change logo and link login page
-
Hello there gods of code!
I was wondering if any php goeroe can take a swing at my problem I have going on here. My html / css skills are pretty good, but PHP is like a different language. I can read it, I understand it but I can’t type it really good…
The following, I want to customize my login-page with a branded logo. I know that is really easy to do to hack the login-css. That’s crap due updates will kill that adjustment. So I thought, what if I try doing it with the functions.php:
function replace-wp-logo() { echo '<style type="text/css"> h1 a { background-image:url('.get_bloginfo('template_directory').'/images/logo.png) !important; } </style>'; } add_action('login_head', 'replace-wp-logo');
Not that big of a deal, think this snippet is well known. For once who don’t know it, this replaces the WP logo to a custom logo. Just upload a new logo in your image folder in your theme (/images/logo.png) and make sure its 310×70. Note… if you want different dimensions you can, but than you have to customize the login file. Thats exactly I don’t want due I want to leave the updates files when upgrading WP to be left alone.
So the thing i’m struggling with is to add code in this snippet what also changes the title and link of the logo. I don’t know if it can be done in the functions.php. I also want to use as less as possible plug-ins.
The thing I tried is to add:
function change_wp_login_url() { echo bloginfo(‘url’); } function change_wp_login_title() { echo get_option(‘blogname’); } add_filter(‘login_headerurl’, ‘change_wp_login_url’); add_filter(‘login_headertitle’, ‘change_wp_login_title’);
But that is not working, also this kinda is where my knowledge of PHP exceeds myself. I copy pasted this from some kind of blog.
Im constructing my own theme from scratch, due I want to learn and understand the Worpress codex and loop better than I did as so learing PHP. There still is allot of work to do, but you can take a look here (https://www.tekortschot.nl) maybe I made a flaw somewhere else and thats the reason this piece of code in the functions.php is failing.
Thanks in advance, and with regards,
Paul
- The topic ‘functions.php change logo and link login page’ is closed to new replies.