Undefined array key for template i installed

Hello,

I am learning php. I am used to editing and customizing html/css responsive websites. This is my first time doing it with a wordpress template. I get an error on my website where it says:

Warning : Undefined array key “icon_box_column_number_mobile” in /home/y9cfo6b6l566/public_html/shophgofficial.com/wp-content/plugins/arrowpress-core/includes/elementor/widgets/icon-box.php on line 1128

I went and downloaded that file and opened it in dreamweaver.

This is the whole section it is in.

protected function render() {
$this->apr_sc_icon_box();
$settings = $this->get_settings_for_display();
$columns = $settings[‘icon_box_column_number’];
$columns_tablet = $settings[‘icon_box_column_number_tablet’];
$columns_mobile = $settings[‘icon_box_column_number_mobile’];
$item_desktop = $settings[‘number_item’];
$item_tablet = $settings[‘number_item_tablet’];
$item_mobile = $settings[‘number_item_mobile’];
$item_1200 = $settings[‘number_item_1200’];
$custom_icon_position = $settings[‘custom_icon_position’];
if ( empty( $settings[‘slides’] ) ) {
return;
}
$this->add_render_attribute( ‘icon’, ‘class’, [ ‘elementor-icon’, ‘elementor-animation-’ . $settings[‘hover_animation’] ] );

I know I probably need to add something like an if(isset somewhere or maybe something else. I went to a couple of php sites and looked up array count values because I am trying to break it down and figure out what each section of the code means, so I can figure out what the error is trying to say and what it is I need to do to fix it.

I went to: PHP: array_count_values - Manual

but I feel like I need some more help on this.

I know someone on here could post an answer to the coding but can anyone be merciful enough to break it down for me what the line is saying in layman’s terms and how the solution fixed it???

Thank you. Sorry for being annoying!!! Apologies if this was already answered. I tried googling on the search to see if this is something that has already been asked 100 times, but I didn’t see it? Maybe it was and I just didn’t realize it.

Sorry if this was all confusing. I can provide an admin password or something to see what it is I’m talking about or I can send over the files in a zip file.

This line is your problem. The error is telling you that the array $settings does not contain the key 'icon_box_column_number_mobile'. This could be for any number of reasons; you need to decide whether it’s ok to not have that data and if so, what you’re going to do if you don’t have it. The obvious solution would be to provide a default:

if (isset($settings[‘icon_box_column_number_mobile’])) {
    $columns_mobile = $settings[‘icon_box_column_number_mobile’];
} else {
    $columns_mobile = 'Some default value you decide on';
}
Sponsor our Newsletter | Privacy Policy | Terms of Service