[wp-hackers] Removing wp_admin_css from login only

Lynne Pope lynne.pope at gmail.com
Thu Jan 15 13:10:31 GMT 2009


I didn't try any custom login plugins prior to this. I did go to each of the
plugin author's sites and looked at their blog posts, but didn't see any
evidence that the plugins were removing the admin css.

I've been including a user-functions.php file in my theme functions.php for
some time - ever since I realised I was reusing the same code over and over,
with different sites, different themes and different versions of WordPress.
Basically, I just have to copy this file, add the include in functions.php
and simply check that my custom code works as expected.

Originally, it had little more than filters for wpautop and wptexturize,
removal of the_generator, and the rsd_link. It's grown quite a bit since
then as everytime I find I am reusing functions I add them to the file.
Where I found I was reusing the same plugins and those plugins were just a
few lines of code, these got added too.

You can call the user-functions.php file anything you like. I keep that name
because its easy for everyone to identify.
I'm really happy I went in this direction because its made developing and
upgrading sites a lot faster.

Lynne


2009/1/16 Joel Fisher <joelfisher at gmail.com>

> cool. Can you explain how user-functions works?
>
> Do you just do an include within functions and then include all custom
> additions in that so functions stay intact?
>
> Did you try the custom login plug prior to this?
>
> I like your approach, especially for reusing it in the future.
>
> Sent from my iPhone
>
>
> On Jan 15, 2009, at 7:00 AM, Lynne Pope <lynne.pope at gmail.com> wrote:
>
>  Thanks Jeremy, this did the trick perfectly. I now have an unhacked
>> wp-login.php ;)
>>
>> I added the function to my custom user-functions.php (which gets included
>> in
>> the theme's functions.php) along with changes to login_headerurl and
>> login_headertitle, and the addition of my own CSS file, and viola! 5
>> minutes
>> work for a custom login screen with all WP version identification removed.
>>
>> I prefer to do this through the theme since I always style the login to
>> match the theme and could never see the need for going the plugin route
>> for
>> styling.
>>
>> Its nice not to be hacking the core though!
>>
>> Lynne
>>
>>
>> 2009/1/16 Jeremy Visser <jeremy.visser at gmail.com>
>>
>>  On Thu, 2009-01-15 at 16:22 +1300, Lynne Pope wrote:
>>>
>>>> I need to remove the wp_admin_css from the login screen only and am
>>>>
>>> having a
>>>
>>>> heck of a time working out how to do this.
>>>>
>>>> I have a custom login using my own stylesheets through my themes
>>>>
>>> functions.
>>>
>>>> I don't need the admin css to load into the headers.
>>>>
>>>
>>> This ought to do the trick:
>>>
>>>      <?php
>>>      /*
>>>      Plugin Name: Kill Login CSS
>>>      */
>>>
>>>      function kill_login_css($tag) {
>>>              return '';
>>>      }
>>>      if (basename($_SERVER['PHP_SELF']) == 'wp-login.php')
>>>              add_action('style_loader_tag', 'kill_login_css');
>>>
>>>      ?>
>>>
>>>
>


More information about the wp-hackers mailing list