Tagged: catch responsive, image size
- This topic has 5 replies, 2 voices, and was last updated 7 years, 8 months ago by
Mahesh.
-
AuthorPosts
-
January 22, 2016 at 1:46 am #83427
Mouvance web
MemberHi,
Sorry for my english and thank you very much for your work and all your themes. I’d like to know how to add a new image size on free catch responsive theme. I tried this code (and other) but it didn’t work, the servor failed :if ( function_exists( 'add_image_size' )) { add_image_size( 'header-size', 1200, 300, false ); } add_filter('image_size_names_choose', 'my_image_sizes' ); function my_image_sizes($sizes) { return array_merge ( $sizes, array( 'header-size' => __( 'Dimensions de l'image d'en-tete'), )); }
I wrote it in the functions.php file of my child theme. My aim is to have a new image size for my header picture. I don’t know if it is necessary to add code in the header.php file.
Thank you!January 22, 2016 at 3:24 pm #83443Mahesh
KeymasterHi @Mouvance web,
I didn’t get what you mean by header-size image size. Where do you want to actually use it? Please clarify more.
Regards,
MaheshJanuary 22, 2016 at 4:39 pm #83453Mouvance web
MemberI subsitute the slider by one main image in the header. I would like that images download in #header-featured-image be systematically resized, 1200px for the width, 300px for the height.
Currently, images are resized at 1200px for width, 400px for height. I know that I can resize images manually, but it’s important that it be computerized. I hope I have been clear…Thank you!January 22, 2016 at 5:20 pm #83458Mahesh
KeymasterHi @Mouvance web,
Thank you for the clarification.
For that you need to create a child theme. Please visit this LINK to find more details on creating the child theme. Then in child theme’s functions.php add the following function.function catchresponsive_custom_header() { $options = catchresponsive_get_theme_options(); if ( 'light' == $options['color_scheme'] ) { $default_header_color = catchresponsive_get_default_theme_options(); $default_header_color = $default_header_color['header_textcolor']; } else if ( 'dark' == $options['color_scheme'] ) { $default_header_color = catchresponsive_default_dark_color_options(); $default_header_color = $default_header_color['header_textcolor']; } $args = array( // Text color and image (empty to use none). 'default-text-color' => $default_header_color, // Header image default 'default-image' => get_template_directory_uri() . '/images/headers/buddha.jpg', // Set height and width, with a maximum value for the width. 'height' => 300, 'width' => 1200, // Support flexible height and width. 'flex-height' => true, 'flex-width' => true, // Random image rotation off by default. 'random-default' => false, // Callbacks for styling the header and the admin preview. 'wp-head-callback' => 'catchresponsive_header_style', 'admin-head-callback' => 'catchresponsive_admin_header_style', 'admin-preview-callback' => 'catchresponsive_admin_header_image', ); $args = apply_filters( 'custom-header', $args ); // Add support for custom header add_theme_support( 'custom-header', $args ); }
Regards,
MaheshJanuary 22, 2016 at 6:02 pm #83460Mouvance web
MemberIt’s perfect, it works!!!!I didn’t need color and default image arguments, but the other part is exactly what I need! Thank you very much,
Regards,
Mouvance WebJanuary 25, 2016 at 9:27 am #83649Mahesh
KeymasterHi @Mouvance web,
Thank you for your appreciation.
Regards,
Mahesh -
AuthorPosts
- The topic ‘Add image size’ is closed to new replies.