Home › Forums › WoodMart support forum › The Header logos and Widgets = Image elements have no explicit width and heigh
The Header logos and Widgets = Image elements have no explicit width and heigh
- This topic has 6 replies, 2 voices, and was last updated 4 years ago by
Artem Temos.
-
AuthorPosts
-
February 28, 2021 at 10:46 am #269843
Florian HonoldParticipantHi there,
how can i fix the pagespeed insights requirement Image elements have no explicit width and height.
pagespeed insight would like the information for some pictures and the woodmart lazyloading lazy.png
Can me help one pls?
March 1, 2021 at 6:59 am #269983
Artem TemosKeymasterHello,
Please, provide us your admin access so we can log in and check this on your side.
Thank you in advance.
March 1, 2021 at 3:19 pm #270162
Florian HonoldParticipantYou Admin Access
March 1, 2021 at 3:46 pm #270166
Artem TemosKeymasterYou have 0 width for your product categories https://prnt.sc/10ai8ro
It is set in your Customizer options here http://prntscr.com/10ai8gm
As for the height attribute, put the following code snippet to the functions.php file in your child theme to add itfunction woodmart_category_thumb_double_size( $category ) { $small_thumbnail_size = apply_filters( 'subcategory_archive_thumbnail_size', 'woocommerce_thumbnail' ); $dimensions = wc_get_image_size( $small_thumbnail_size ); $thumbnail_id = get_term_meta( $category->term_id, 'thumbnail_id', true ); $attr_height = ''; if( woodmart_loop_prop( 'double_size' ) ) { $small_thumbnail_size = 'woodmart_shop_catalog_x2'; $dimensions['width'] *= 2; if ( $dimensions['height'] ) { $dimensions['height'] *= 2; } $attr_height = 'height="' . esc_attr( $dimensions['height'] ) . '"'; } if ( $thumbnail_id ) { $image = wp_get_attachment_image_src( $thumbnail_id, $small_thumbnail_size ); $image = $image[0]; } else { $image = wc_placeholder_img_src(); } if ( $image ) { // Prevent esc_url from breaking spaces in urls for image embeds // Ref: https://core.trac.wordpress.org/ticket/23605 $image = str_replace( ' ', '%20', $image ); echo apply_filters('woodmart_attachment', '<img src="' . esc_url( $image ) . '" alt="' . esc_attr( $category->name ) . '" width="' . esc_attr( $dimensions['width'] ) . '" ' . $attr_height . ' />', $thumbnail_id, $small_thumbnail_size ); } }
As for the logo image and brands, we will add attributes to them in our next theme update.
March 1, 2021 at 4:13 pm #270172
Florian HonoldParticipantOk thanks for the help. All work has been done. When can I expect the update?
March 1, 2021 at 5:09 pm #270186
Florian HonoldParticipantA problem was just sent to me by the Google search console via email.
Attachments:
You must be logged in to view attached files.March 2, 2021 at 7:09 am #270270
Artem TemosKeymasterWe will release a new update later this month.
-
AuthorPosts
- You must be logged in to create new topics. Login / Register