0

I would like to add an extra feature to one of the default widgets so that the user can choose from the select-field to either align the widget to the left, center or to the right.

enter image description here enter image description here

How would I be able to achieve this without tampering with any of the files outside of my themes directory?

1

The default widgets do not offer any hooks for that. You have to replace the default widget and add your field to the new class.

The other option would be using JavaScript to insert the field, and a filter for 'update_option_widget_' . $widget->id_base to save the value.

I think the separate class is the cleaner approach.

  • 1
    Or a brand new widget class based on the original(maybe with a slightly different name, thus making it easy to differentiate between the two). – t31os May 1 '13 at 15:42
  • Yes, that would be option 1. – fuxia May 1 '13 at 15:47
  • Yes, i agree. :) – t31os May 1 '13 at 15:48

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.