• I am having a little trouble with the settings page in the template I am working on.

    In the function.php file I have a hook that creates an “Theme Options” page that allows admin to upload a new header image for the theme.

    The problem is that the functions page is causing problems with the rest of the admin site.

    Whenever I try and create a new page I get a header already sent error.

    Warning: Cannot modify header information - headers already sent by (output started at /home/clubsdot/public_html/wp-content/themes/subway/functions.php:59)

    Below is a copy of my functions file, this has me stumped, anyone knows what is causing the problem?

    Thanks,
    Levi Putna

    <?php
    // Hook for adding admin menus
    add_action('admin_menu', 'add_menu');
    
    function add_menu() {
       add_theme_page(__('Theme Options'), __('Theme Options'), 8, basename(__FILE__), theme_options);
    }
    
    function theme_options(){
    ?>
    <div class="wrap">
    <h>
    	<h2>Current Theme Options</h2>
    
    	<form id="post" method="POST" enctype="multipart/form-data" action="" name="post">
    		<div class="wrap">
    			<div id="poststuff">
                <br />
    				<div id="submitpost" class="submitbox">
                    	<div class="inside">
                        <h4>Header image</h4>
                        <p>Header images must be in jpg format with a minimum width of 800px and a height of 200px.</p>
                    	</div>
                        <p class="submit">
                        	<input id="save-post" class="button button-highlighted" type="submit" tabindex="4" value="Save" name="save"/>
    						<br class="clear"/>
                        </p>
                    </div>
                    <div id="post-body">
                        <div id="titlediv">
                        	<h3>Header Image</h3>
                            <div id="titlewrap">
                              <input id="header_image" type="file" c name="header_image" tabindex="1" size="96" />
                            </div>
                            <?php
                           if($_POST){
                                if (is_uploaded_file($_FILES['header_image']['tmp_name'])){
        include_once($sStyleFolder . 'images/header/generator.php');
        $header =  generateHeader($sStyleFolder, $_FILES['header_image']);
    }
                            }
    
    			?>
                        </div>
                    </div>
    			</div>
    		</div>
    	</form>
    
    </div>
    
    <?php
    }
    
    ?>
    
    <?php
    if ( function_exists('register_sidebar') )
    register_sidebar(array('name'=>'Page_Sidebar',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    
    register_sidebar(array('name'=>'Post_Sidebar',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    
    register_sidebar(array('name'=>'Search_Sidebar',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    
    register_sidebar(array('name'=>'Single_Sidebar',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    
    register_sidebar(array('name'=>'Header',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    
    ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘header already sent error’ is closed to new replies.