Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
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. –  toscho May 1 '13 at 15:47
    
Yes, i agree. :) –  t31os May 1 '13 at 15:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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