0

I am trying to add a select option to help user align the gravatar image. The problem is all value are saved except for the Image Alignment. When they select Image Alignment, it will revert back to "None"

http://pastebin.com/03fj7tc6

Any help would be highly appreciated

1
  • Hi JPL, if you really want someone helps you, try to extract the relevant part of your code and put it in the question body. If you link all that code in an external site, I bet no one will read it all and so no one can help you.
    – gmazzap
    Feb 1, 2014 at 0:09

1 Answer 1

0

On the update() function, you need to modify

$instance['image_alignment'] = isset($new_instance['image_alignment'] );

to

$instance['image_alignment'] = $new_instance['image_alignment'];

isset() is making the variable boolean, while you are expecting string.

4
  • Thanks man it works, my last problem is calling the wordpress default CSS class when the image_alignment applies. I added this line which call the avatar pastebin.com/DtnGXk6Y but no changes happen
    – JPL
    Jan 27, 2014 at 2:03
  • You should wrap the avatar within a span or div and apply the alignment on the element. get_avatar doesn't allow styling arguments. check the get_avatar() function reference
    – Shazzad
    Jan 29, 2014 at 14:36
  • Thanks i tried adding a class but I got a parse weird error pastebin.com/63S8drq3 i tried adding ?> after echo and <?php after div but still the same
    – JPL
    Jan 31, 2014 at 3:10
  • I also tried adding a filter and i get this error 192.185.107.164/~jefreyla code reference pastebin.com/v6PGfW6C
    – JPL
    Jan 31, 2014 at 4:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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