• Resolved kerrypolka

    (@kerrypolka)


    Hello!

    I’d like to change my header size so it’s a little shorter – the image I’d like to use is 1000×270, but I’m happy for it to be smaller, as long as it’s proportionate. At the moment part of it is cropped out. It’s at https://ptp.staging.wpengine.com/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello!

    Penscratch is programmed to always crop the logo at 937px wide and 300px high.

    If you’d like to change its size, you can override the parent theme’s programming, you would first need to set up a child theme and then add the following to the functions.php file:

    function child_remove_parent_function() {
        remove_action( 'init', 'penscratch_custom_header_setup' );
    }
    add_action( 'wp_loaded', 'child_remove_parent_function' );
    
    function penscratch_child_custom_header_setup() {
    	add_theme_support( 'custom-header', apply_filters( 'penscratch_custom_header_args', array(
    		'default-image'          => '',
    		'default-text-color'     => '666666',
    		'width'                  => 937,
    		'height'                 => 300,
    		'flex-height'            => true,
    		'wp-head-callback'       => 'penscratch_header_style',
    		'admin-head-callback'    => 'penscratch_admin_header_style',
    		'admin-preview-callback' => 'penscratch_admin_header_image',
    	) ) );
    }
    add_action( 'after_setup_theme', 'penscratch_child_custom_header_setup' );
    

    From the above function, switch the value of 937 with the width you’d like your logo to be and 300 with the desired height.

    After you have saved your changes, you may need to use the following plugin to regenerate your thumbnails before noticing a change:

    https://www.ads-software.com/plugins/regenerate-thumbnails/

    Let me know how you get on with those steps or if you have any extra questions while walking through them.

    Thread Starter kerrypolka

    (@kerrypolka)

    Thank you very much (and for your patience while I sort out my header issues! ?? )

    I’ve created a child theme and dropped in that code, but it’s giving me the error message:

    Parse error: syntax error, unexpected ‘}’ in /nas/content/staging/ptp/wp-content/themes/penscratch-child/functions.php on line 20

    I’ve deleted the first ‘}’ to see if that would do anything, but it give me the same error message.

    Hi @kerrypolka,

    Could you paste all of the code you’ve entered into your child theme’s functions.php file in your next reply? I’ll see if I can spot the error. ??

    Thread Starter kerrypolka

    (@kerrypolka)

    This is very odd – when I saved it the first time it gave me that error message, but I copied and pasted it again to try to duplicate it, and it went through fine. So, er, everything’s all right! Thank you!

    I’m glad that everything worked out in the end!

    The initial issue may have been anything from a stray } or missing {. Code is fussy. ??

    You know where to find us if any extra questions come up.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Change header size (or not force cropping)?’ is closed to new replies.