0

I use wordpress. I add animation to widget (successfully added) But in my frontpage i get this notice

Notice: Undefined index: animation in /home/xx/layouts/widget.php on line 99
Notice: Undefined variable: animation in /home/xx/layouts/widget.php on line 101

Line 99 :

if ($params['animation']) $animation = 'data-uk-scrollspy="{cls:\''.$params['animation'].'\'}"';

Line 101 :

echo '<div class="'.implode(' ', $classes).'" '.$animation.'>'.$badge.$title.$content.'</div>';

Thanks

sectus
  • 15,605
  • 5
  • 55
  • 97
leopoldjobs
  • 65
  • 1
  • 1
  • 8

2 Answers2

1

in array $params You don't have element: 'animation'

to quick repair :

change 99 to:

 $animation = isset($params['animation']) ? 'data-uk-scrollspy="{cls:\''.$params['animation'].'\'}"' : '';
ryrysz
  • 907
  • 5
  • 11
  • Thanks for answer . I change this line but now all of object have animation didn`t load – leopoldjobs Oct 07 '14 at 23:05
  • Animations are not loaded because $params don't have 'animation' element. Before changing animations work properly? – ryrysz Oct 07 '14 at 23:10
  • Yes animation work perfect.But i get this notic.After i change this line animation didn`t work – leopoldjobs Oct 07 '14 at 23:12
  • can You try new answer ? – ryrysz Oct 07 '14 at 23:19
  • sorry for my bad english. before your answer animation worked perfectly.After your solution now animation not work and object not load (didn`t show) – leopoldjobs Oct 07 '14 at 23:22
  • my english is to no good :D. But did you tried my corrected answer ? In the old missed one character. You can also try: $animation = isset($params['animation']) ? 'data-uk-scrollspy="{cls:\''.$params['animation'].'\'}"' : 'data-uk-scrollspy="{cls:\'\'}"'; – ryrysz Oct 07 '14 at 23:28
  • thanks this last code worked fully.but i have new code for line 99 this code get same notic on frontpage------------if ($params['animation']) $animation = 'data-uk-scrollspy="{cls:\''.$params['animation'].'\''.(($params['animation_repeat']) ?', repeat: true':'').'}"'; – leopoldjobs Oct 08 '14 at 00:07
0

Line 99 :

$animation = "";
if (isset($params['animation'])) $animation = 'data-uk-scrollspy="{cls:\''.$params['animation'].'\'}"';

And maybe you could add a default animation

  • Thanks this solution worked perfectly.Now i want to use new code for line99-can you fix this code?-----code-----if ($params['animation']) $animation = 'data-uk-scrollspy="{cls:\''.$params['animation'].'\''.(($params['animation_repeat']) ?', repeat: true':'').'}"'; – leopoldjobs Oct 08 '14 at 07:26