Home › Forums › WP RESIDENCE – Real Estate WordPress Theme FORUM › How to overwrite widgets in child theme
This topic contains 0 replies, has 1 voice, and was last updated by Anna 1 year, 12 months ago.
Widgets are not part of hierarchical parent/child theme relation, so you would need to to it in another way.
The process involve writing code in child theme – here are the steps using libs/widgets/footer_latest_widget.php as example
The simplest it would be to register a copy of the widget inside the child function.php and develop a new one with the changes you need.
in child functions.php
Start by register_widget(‘Footer_latest_widget_copy’); – see widgets.php
have a file footer_latest_widget_copy.php in your child theme – with the same code as footer_latest_widget.php – don’t forget to include it
in footer_latest_widget_copy.php replace Footer_latest_widget with Footer_latest_widget_copy
In this way you obtain a clone of the original widget and you can apply the changes in there.
You must be logged in to reply to this topic.