1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

wordpress theme developement custom header

Discussion in 'WordPress' started by saturn100, Feb 7, 2017.

  1. #1
    Hey
    I am currently developing themes for wordpress
    I am looking to add the funtion for the admin to add a custom header image which I know is pretty standard

    I have found and am using code to do this and while it works in uploading an image it is not allowing resizing or cropping

    After uploading the image it goes to crop image but there are no dancing ants to crop it and when I hit Crop Image it says there is an error
    I can skip cropping but then it displays the image in its orginal size

    Is there something wrong in my code or am I missing something
    here is my code
    I have tried it with flex and without

    //custom header
    add_theme_support( 'custom-header' );
    
    
    function themename_custom_header_setup() {
        $defaults = array(
            // Default Header Image to display
            'default-image'         => get_template_directory_uri() . '/images/headers/default.jpg',
            // Display the header text along with the image
            'header-text'           => false,
            // Header text color default
            'default-text-color'        => '000',
            // Header image width (in pixels)
             'flex-width'    => true,
       
            'width'             => 1000,
            // Header image height (in pixels)
            
        'flex-height'   => true,
            'height'            => 198,
            // Header image random rotation default
            'random-default'        => false,
            // Enable upload of image file in admin
            'uploads'       => false,
            // function to be called in theme head section
            'wp-head-callback'      => 'wphead_cb',
            //  function to be called in preview page head section
            'admin-head-callback'       => 'adminhead_cb',
            // function to produce preview markup in the admin screen
            'admin-preview-callback'    => 'adminpreview_cb',
            );
    }
    add_action( 'after_setup_theme', 'themename_custom_header_setup' );
    
    //end custom header
    
    PHP:
    any ideas of what I need to do
     
    saturn100, Feb 7, 2017 IP