Jump to content

Getting header errors by linking .css to top of .php file...


Jim R

Recommended Posts

I'm trying to link think a .php file full of functions to the following stylesheet

Quote

<link href="/styles/playerProfiles.css" rel="stylesheet" type="text/css">

I have it above the <?php tag.  I have tried echoing it inside the <?php and ?>, but it produces the same error.

Getting this error:

Quote

Warning: Cannot modify header information - headers already sent by (output started at /public_html/wp-content/plugins/csi_custom.php:2) in /home2/csi/public_html/wp-includes/functions.php on line 6029

Warning: Cannot modify header information - headers already sent by (output started at /public_html/wp-content/plugins/csi_custom.php:2) in /home2/csi/public_html/wp-admin/includes/misc.php on line 1252

Warning: Cannot modify header information - headers already sent by (output started at /public_html/wp-content/plugins/csi_custom.php:2) in /home2/csi/public_html/wp-admin/admin-header.php on line 9

 

Link to comment
Share on other sites

8 hours ago, Jim R said:

How to link the .css file without creating the header error?

This issue is that the php files have functions that throw an error if there's any output before those functions are run, right? Wouldn't then the solution be to put any output after those functions are run?

 

*Hint* The CSS link in your HTML is output.

Edited by maxxd
Link to comment
Share on other sites

44 minutes ago, maxxd said:

This issue is that the php files have functions that throw an error if there's any output before those functions are run, right? Wouldn't then the solution be to put any output after those functions are run?

 

*Hint* The CSS link in your HTML is output.

I've tried this, but it doesn't change the result.  I'm not really sure the order has much do with it, unless it's inside a loop or directly passing information along.  

I've echoed it within the function.  I've put it after the ?>.  I posted that above in the OP.  No matter I've put it, the CSS works, but it creates header errors.  

 

I have other PHP files with CSS links above the <?php without these errors.  I'm wondering if it's a function issue.  What I'm working on at the moment, it worked fine until I tucked it into a function vs. using INCLUDE.  I was surprised echoing it in the PHP code triggered the error.

 

Edited by Jim R
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.