I just updated my theme and I'm having errors on the homepage, the elements of the visual composer do not appear, and I get a php error.
Undefined index: focus in /inc/admin/option-tree/ot-functions.php:57
echo $start." a:focus { color: " . $array['focus'] ."; }\n";
}
}
}
I do not know much about php, so I do not know how to solve. Any advice?
Thanks
I just updated my theme and I'm having errors on the homepage, the elements of the visual composer do not appear, and I get a php error.
Undefined index: focus in /inc/admin/option-tree/ot-functions.php:57
echo $start." a:focus { color: " . $array['focus'] ."; }\n";
}
}
}
I do not know much about php, so I do not know how to solve. Any advice?
Thanks
This type of error generally occurs when the index is not set in the array. You can use the function isset in if like if( isset ( $array['focus'] ) && !empty( $array['focus'] ) ){ }. This code will first check either the index focus exists in the $array or not. If the index exists then it will check either it is empty or not. If it fulfills both conditions then it will enter in the body of the if and you will not see the undefined index error.
focus
item exists in the$array
array. So you could put theecho
in anif
block -if ( ! empty( $array['focus'] ) ) { echo ...; }
– Sally CJ Commented Jan 17, 2019 at 13:19