Answer the question
In order to leave comments, you need to log in
How to set a new image size in WordPress?
Hello. You need to make a new image size for images-media files in WordPress. To make it appear on the menu.
The images will be 600 by 400. I write the code in "Theme Functions (functions.php)":
add_image_size( 'true-fullwd', 700 );
add_filter('image_size_names_choose', 'true_new_image_sizes');
function true_new_image_sizes($sizes) {
$addsizes = array(
"true-fullwd" => 'По ширине контента'
);
$newsizes = array_merge($sizes, $addsizes);
return $newsizes;
}
Answer the question
In order to leave comments, you need to log in
Try this (instead of the code you wrote above):
add_theme_support( 'post-thumbnails' );
add_image_size( 'По ширине контента', 600, 400);
add_image_size( string $name, int $width, int $height, bool|array $crop = false )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question