WordPress.org

Ready to get started?Download WordPress

Forums

theme/functions.php produces plugins activation error (9 posts)

  1. cinemaminima
    Member
    Posted 6 years ago #

    To use widgets in Theme "Basic 1.0" in WP 2.3.3, I add the functions.php file to the theme directory. After doing this, when I activate a plugin from the plugins page, it returns the following error. Taking out the functions.php file restores the plugin activation function.

    Please, How can I keep the functions.php file, and have plugins activate normally?

    Warning: Cannot modify header information - headers already sent by (output started at /home/apollo/public_html/lightandpower/public/wp-content/themes/cm00/functions.php:1) in /home/apollo/public_html/lightandpower/public/wp-includes/pluggable.php on line 390
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/apollo/public_html/lightandpower/public/wp-content/themes/cm00/functions.php:1) in /home/apollo/public_html/lightandpower/public/wp-includes/pluggable.php on line 390
  2. richarduk
    Member
    Posted 6 years ago #

    Presumably you have something like this at the top of functions.php?

    <?php
    if ( function_exists('register_sidebars') )
    	register_sidebars(1);

    Which basically says allow one container full of widgets

  3. moshu
    Member
    Posted 6 years ago #

    A simple search for "Warning: Cannot modify header information" would have give you the answer.
    You have a blank line or space at the very top of your functions.php - before the opening <?php

    conf. p-content/themes/cm00/functions.php:1" - where 1 is the line number with error.

    More:
    http://codex.wordpress.org/FAQ_Troubleshooting#How_do_I_solve_the_Headers_already_sent_warning_problem.3F

  4. cinemaminima
    Member
    Posted 6 years ago #

    The functions.php has NO blank spaces or lines. The entire contents of the file are

    <?php
    if ( function_exists('register_sidebar') )
    register_sidebar();
    ?>
  5. cinemaminima
    Member
    Posted 6 years ago #

    Changing the file encoding from UTF-8 to ASCII seems to have fixed the problem. I don't understand why.

  6. moshu
    Member
    Posted 6 years ago #

    If you are 100% sure about that... one of your plugins might have the space. Deactivate all of them and activate one by one. When the error re-appears, there is the blank.

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Changing the file encoding from UTF-8 to ASCII seems to have fixed the problem. I don't understand why.

    UTF-8 files include characters at the beginning of them called the "BOM", which is short for Byte Order Marker. Not all editors put the BOM there, but some do. And PHP is not happy about it being there.

    Use ascii mode when editing PHP files.

  8. cinemaminima
    Member
    Posted 6 years ago #

    Thanks, Otto42!

    It really helps to understand why things work/don't work!

    I am going to tell my text editor (BBedit) to default to "UTF-8 (no BOM)"

  9. landscribe
    Member
    Posted 5 years ago #

    UTF-8 files include characters at the beginning of them called the "BOM", which is short for Byte Order Marker. Not all editors put the BOM there, but some do. And PHP is not happy about it being there.

    Use ascii mode when editing PHP files.

    Thanks! Exactly the problem I was having when trying to widgetize my theme!

Topic Closed

This topic has been closed to new replies.

About this Topic