• Resolved bigabig

    (@bigabig)


    Hello,
    I’m using Vantage and created a child theme.

    I’m trying to override inc/widgets.php but it ain’t working. My modification works beautifully if done in the parent theme. However I don’t want to lose the changes with the next vantage update, so i would like to override the file in my child theme…

    How to do this? Copy the widgets.php to the root directory of my child theme does not work.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @bigabig

    Thanks for reaching out.

    Child theming is easy and works really well for regular theme files like footer.php etc. It’s not as easy when it comes to changing functions. If you’re starting to dive into this more advanced side of things then you could give this a quick read:

    http://themeshaper.com/2009/05/03/filters-wordpress-child-themes/

    You’d most likely need to create new widgets in your child theme by extending the existing widgets. If you really want you could reregister the old ones. Just have to make sure the reregistration action runs after the initial registration action.

    This is an intermediate to advanced topic so, unfortunately, beyond the support scope we’re able to offer here. Hopefully the above sets you down the right research path.

    All the best.

    Thread Starter bigabig

    (@bigabig)

    Ok, Thank you.
    I think I will just copy a vantage widget, change some of the behaviour and register the widget under a different name in my child themes functions.php 😀
    I hope it will work^^

    Should do the trick 🙂

    Thread Starter bigabig

    (@bigabig)

    jeah it worked 😀

    its fine for me and now i have my custom My_CircleIcon_Widget extending the WP_Widget 😀

    However I think it would be a better style extending the Vantage_CircleIcon_widget and only overwriting the necessary functions. But this doesn’t work for me because the child theme can’t find the declaration / class of Vantage_CircleIcon_Widget, wich is located in the parent theme. It seems like I need something like: “Hey you have to look in the parent theme to find the Vantage_CircleIcon_Widget class!”.

    Well, in case you know how to achieve this I would appriciate an answer. Otherwise, my current solution works fine 😀

    Glad to hear you made progress. Due to time and resource restrictions we, unfortunately, can’t really assist development level questions. What you’d need to do is include your class definitions slightly later because the child theme’s functions.php is included first.

    Hope that helps 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Override /inc/widgets.php’ is closed to new replies.