Support » Fixing WordPress » Adding Custom Header support error…. help me!

  • Hello,

    I want to add Custom Header support to a theme I am creating. I have added the following snippet of code to functions.php.

    if ( !function_exists('customisetheme_setup') ):
        function customisetheme_setup() {
            define( 'HEADER_IMAGE', '%s/header/default.jpg' );
            define( 'HEADER_IMAGE_WIDTH', apply_filters( 'customisetheme_header_image_width', 250 ) );
            define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'customisetheme_header_image_height', 125 ) );
            define( 'NO_HEADER_TEXT', true );
            add_custom_image_header( '', 'customisetheme_admin_header_style' );
            $customHeaders = array (
                    'amantea' => array (
                    'url' => '%s/header/default.jpg',
                    'thumbnail_url' => '%s/header/default.jpg',
                    'description' => __( 'Amantea', 'customisetheme' )
                    'colosseum' => array (
                    'url' => '%s/header/colosseum.jpg',
                    'thumbnail_url' => '%s/header/colosseum.jpg',
                    'description' => __( 'Colosseum', 'customisetheme' )
    if ( ! function_exists( 'customisetheme_admin_header_style' ) ) :
        function customisetheme_admin_header_style() {
            <style type="text/css">
                #wpbody-content #headimg {
                    height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
                    width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
                    border: 1px solid #ccc;
    add_action( 'after_setup_theme', 'customisetheme_setup' );

    Okay. The Custom Header options page does work, however when publishing with the WordPress editor or publishing a post, the evil Headers already sent error pops up.

    Warning: Cannot modify header information - headers already sent by (output started at /home2/goofball/public_html/dragg/wp-content/themes/ClicknDraggBlank/functions.php:8) in /home2/goofball/public_html/dragg/wp-includes/pluggable.php on line 934

    I have already read the FAQ Troubleshooting page in the Codex. (Note: I may be completely wrong about what I am about to say…) My problem is that I intend to distribute the theme I am creating so telling others to edit their wp-config.php or pluggable.php is not gonna happen, if that is the problem.

    I don’t even know where to start. I am fairly confident the custom header code I put in functions.php is the troublemaker.

    Any help would be very greatly appreciated. Thanks!
    If there is an area of this you would like me to expand on or explain better please tell me and I will try my best…

  • The topic ‘Adding Custom Header support error…. help me!’ is closed to new replies.