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?

  • 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

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.

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.

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.