Logo cropped - suggested 400x200

Hello,

I try to add a logo on my website using “change logo”. The original image size is 1140x220. It always asks me to crop my image (suggested 400x200). If I extend the selection to the whole image the quality is bad, and it uses a resized copy of the original image.

I tried to add custom CSS :
img.custom-logo {
width: 1140px!Important;
height: 220px!Important;
}

but it doesn’t work. Am I doing something wrong?

Thank you, best regards

Hey there,
Hope you’re doing well today

In order to be able to get the width and height the way you want, you’ll have to edit your functions.php file and change the height and width values in the code shown below to reflect what you’d like to have:

// Enable Custom Logo
add_theme_support( ‘custom-logo’, array(
‘height’ => 200,
‘width’ => 400,
‘flex-width’ => true,
) );

Please note that if you edit this code directly in the parent theme, you will lose it after an update, however, you may use the child theme attached and add the code to the functions.php from that child theme so that your customization is retained with updates.

You may also use the code snippets plugin to add your functions.php customizations in a more convenient manner.

I hope this helps :slight_smile:

Best Regards,
Support

Hello,

Thanks for your support. I already have a child theme, I added the code you gave me in my functions.php but I still have the same problem, it sticks to 400x200. When I update directly the functions.php file of activello theme (parent theme) it works, it asks me for a 1140x220 logo and there’s no need to crop it.

My functions.php looks like :

<?php

// Queue parent style followed by child/customized style
add_action( ‘wp_enqueue_scripts’, ‘func_enqueue_child_styles’, 99);

function func_enqueue_child_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );
wp_dequeue_style(‘activello-style’);
wp_enqueue_style( ‘activello-style’,
get_stylesheet_directory_uri() . ‘/style.css’,
array(‘parent-style’)
);
}

// Enable Custom Logo
add_theme_support( ‘custom-logo’, array(
‘height’ => 220,
‘width’ => 1140,
‘flex-width’ => true,
) );

Something wrong there?

Thank you, best regards,
Nonane

Hello,

I finally managed to wake it work using my child theme with this in my functions.php :

// Enable Custom Logo
function activellochild_custom_logo_setup() {
$defaults = array(
‘height’ => 220,
‘width’ => 1140,
‘flex-height’ => true,
‘flex-width’ => true,
‘header-text’ => array( ‘site-title’, ‘site-description’ ),
);
add_theme_support( ‘custom-logo’, $defaults );
}
add_action( ‘after_setup_theme’, ‘activellochild_custom_logo_setup’, 20);

The idea is to wrap it in a function and to make it after activello parent theme setup so that I overwrite it for sure.

Thanks for your help ! Best regards,
Nonane

Awesome great to see you managed to make it work.

Please advise if you have more questions.

Have a fantastic day!