Ecommerce Shopify WordPress Discussion

Notice: Undefined offset: 1, maybe missing an array

I am facing this problem in a WP theme file, as it is not developed anymore. While I am trying to find a replacement to this template, the debug of the site gives me this: Notice: Undefined offset: 1 in /home/***/public_html/wp-content/themes/vip-restaurant/templates/header-footer-sidebars.php on line 18 Warning: A non-numeric value encountered in /home/***/public_html/wp-content/themes/vip-restaurant/templates/header-footer-sidebars.php on line 18 Warning: Division by zero in /home/***/public_html/wp-content/themes/vip-restaurant/templates/header-footer-sidebars.php on line 18 Where at line 18 I find: $width_num = $width_num[0] / $width_num[1]; The entire loop is as follows: $width_num = explode( '-', str_replace( 'cell-', '', $width ) ); $width_num = $width_num[0] / $width_num[1]; $row_width += $width_num; The website looks broken actually, so I am investigating using the debug mode. The php version is 7.4 (there is no way to upgrade the version actually). Can you please help me to face this problem, even if a temporary solution? debug and ad an array, but I am unable to code clearly UPDATE <?php $width = rd_vamtam_get_option( "$area-sidebars-$i-width" ); $fit = ( $width != 'full' ) ? 'fit' : ''; $width_num = explode( '-', str_replace( 'cell-', '', $width ) ); $width_num = $width_num[0] / $width_num[1]; $row_width += $width_num; if ( $row_width > 1 ) { echo '</div><div class="row">'; $row_width = $width_num; } ?>
You can try and set defaults for $width_num[0] and $width_num[1] So: $first_width = $width_num[0] ?? 0; $second_width = $width_num[0] ?? 1; // so that it doesn't divide by 0 or make your own desirable width if no second width was found? $row_width = $row_width < $default_row_width ? $default_row_width : $row_width;

February 4, 2024

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.