Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Every tutorial I've seen on this subject is out of date, so I'm hoping someone here can help me.

I want to style my wp-login.php page with a CSS file. But I'd like to do it in a way that won't get overwritten when Wordpress is updated. From what I can tell, based on the tuts I've read, the best way it to add it using a function in my themes functions.php file. Unfortunately, the code that people have suggested using just doesn't work for me. Here's the code that I've added.

<?php
function custom_login() {
echo '<link rel="stylesheet" href="wplogin/wplogin.css" />';
}
add_action('login_head', 'custom_login');
?>

It does include the stylesheet like I want, but unfortunately I get this error on my page.

Warning: Cannot modify header information - headers already sent by (output started at /home/skyyprod/gointrigue/sandbox/wp-content/themes/rockwell_v1.6/functions.php:899) in /home/skyyprod/gointrigue/sandbox/wp-login.php on line 353

Warning: Cannot modify header information - headers already sent by (output started at /home/skyyprod/gointrigue/sandbox/wp-content/themes/rockwell_v1.6/functions.php:899) in /home/skyyprod/gointrigue/sandbox/wp-login.php on line 365

What am I doing wrong?

share|improve this question
    
what's on line 899 in your functions.php? that code is correct, your error is elsewhere. –  Milo Sep 10 '11 at 2:19
add comment

2 Answers 2

up vote 0 down vote accepted

"Headers already sent" means that some code tried to set a HTTP header (eg. to set a cookie), but that PHP already sent content that will end up in the HTML page. The most likely cause is that you added extra newlines after the ?> closing tag when you edited config.php or functions.php.

The simple solution it to just remove the closing ?> in these files - it is not required anyway.

share|improve this answer
    
You were close! I had my code above placed after everything in my functions.php file. Removing the <?php ?> from my code and putting it within the <?php ?> that was already there stopped the errors. Thanks. –  jimmykup Sep 10 '11 at 21:07
add comment

This error occurs when you manually edit wp-config.php using Notepad OR when you try to send header information after sending something else (header data always goes FIRST, period).

It is hard to tell what you're doing wrong without looking at your functions.php code, but try placing the code at the very beginning of your functions.php file. It should help.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.