I'm trying to make a small modification to a custom widget that was included with a clients parent theme.

Whenever I remove the parents version of the widget (for testing purposes) the child version of the widget does not take over. Instead, the widget simply disappears.

I've mimicked the directory structure of the parent theme, copied my modified widget .php file into the proper location, and have included the following code in my child themes function.php:


Any idea why the child's version of the widget isn't available?

  • 1
    Show us how you have written the "child widget". Did you extend the parent class?
    – kaiser
    Commented May 20, 2013 at 20:29
  • Sorry, I'm not sure what you mean by "extend the parent class". The only edit I did to the widget was remove a div and it's contents.
    – JoshuaG
    Commented May 20, 2013 at 20:48
  • So you copy pasted the files contents, changed it slightly, uploaded it into a child theme sub folder and included it?
    – kaiser
    Commented May 20, 2013 at 21:04
  • Yes, that is correct.
    – JoshuaG
    Commented May 20, 2013 at 21:23
  • Then the same class is loaded twice. It's the same as defining a function twice: It doesn't work.
    – kaiser
    Commented May 20, 2013 at 22:50

1 Answer 1


Either go and extend the class, or copy, paste and rename it (not recommended).

class Child_Theme_Widget extends Parent_Theme_Widget
    // just re-define/override the parent theme widgets methods (functions) here
  • Sorry I'm not sure how to implement this.
    – JoshuaG
    Commented May 20, 2013 at 23:58
  • @user32576 You'll have to read the link to PHP.net and you need to learn some PHP (or get someone who does this for you).
    – kaiser
    Commented May 21, 2013 at 0:15
  • Okay, I'll take a look and see if I can piece it together.
    – JoshuaG
    Commented May 21, 2013 at 0:19
  • 2
    Thanks for your help, I used your suggestion to find a solution. Here's what I did: Registered a new widget function maxmag_tabs_load_widgets() { register_widget( 'maxmag_tabs_widget' ); register_widget( 'maxmag_tabs_child_widget'); } Use the extend function on my new widget class maxmag_tabs_child_widget extends maxmag_tabs_widget { }
    – JoshuaG
    Commented May 21, 2013 at 21:59
  • 1
    @JoshuaG Great that you found a solution! Hint: You can now tick the answer as solution (below the voting arrows on the left side of the question) and even edit the answer to reflect your solution (community edits are appreciated). Comments don't take line breaks - that's what questions and answers are for.
    – kaiser
    Commented May 21, 2013 at 23:30

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.