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.

Can I modify widgets in a child theme? When I change the footer, I don't need extra steps -- it just works. What about widgets?

Example: A widget of a theme I am using makes use of google maps. I'd like to add some options to google maps options array.

My idea is to just copy the widget to the appropriate directory in the child theme and add those lines. Will that work as expected?

share|improve this question
    
Can you be more clear, what kind of modifications do you need? –  Mamaduka Mar 16 '12 at 10:42
    
@Mamaduka I've updated my answer. –  ipavlic Mar 16 '12 at 11:33

2 Answers 2

up vote 1 down vote accepted

Widget are not part of hierarchical parent/child theme relation, so you would need to follow more generic development process:

  1. Optionally disable widget registration in parent theme (if possible to do cleanly - with hooks or otherwise).
  2. Extend (as in widget's PHP class) or fork (copy and modify the code) widget in child theme.
  3. Register your version in child theme.
share|improve this answer

Most of advanced parent themes provide actions and filters too hook into functionality, if this theme doesn't provide filter for google maps widget's options array, then your solution is good way to go.

share|improve this answer

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.