4

I built a some function theme option wordpress.

But I am receiving the following error now, what am I doing wrong?

  if(isset($thm_options['custom_font1_eot']))
    $w_custom_font1_src[] = "url('{$thm_options['custom_font1_eot']['url']}?#iefix') format('embedded-opentype')";

  if(isset($thm_options['custom_font1_woff']))   
    $w_custom_font1_src[] = "url('{$thm_options['custom_font1_woff']['url']}') format('woff')";

  if(isset($thm_options['custom_font1_ttf']))
    $w_custom_font1_src[] = "url('{$thm_options['custom_font1_ttf']['url']}') format('truetype')";

Fatal error: [] operator not supported for strings in

Anything I missed code?

2
  • maybe you want to append string to the var that is already a string $w_custom_font1_src .= "url..." Commented Dec 6, 2016 at 16:55
  • Where is $w_custom_font1_src defined? Commented Dec 6, 2016 at 16:56

1 Answer 1

11

You may have used this variable $w_custom_font1_src as a string somewhere else in the program.

So now reinitialize as an array

 $w_custom_font1_src =  array();
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.