0

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

1
  • That warning usually means you should check if the focus item exists in the $array array. So you could put the echo in an if block - if ( ! empty( $array['focus'] ) ) { echo ...; }
    – Sally CJ
    Jan 17 '19 at 13:19
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.