Theme Developers - Overwriting Hub templates / widgets from inside your theme
There might be times when there is something in your Hub that you would like to change. For example you'd like to remove a section/block or change the design. This can be easily done by creating a child theme and copying over the template from the Dollie plugin folder into your child theme.
A WordPress child theme is a theme that inherits the functionality of another theme, called the parent theme, and allows you to modify, or add to, the functionality of that parent theme. The parent/child structure has been a very popular method to harness the power of WordPress themes because it allows you to modify the styling and layout of a parent theme without editing the files of the parent theme itself. This allows the parent theme to be updated from its upstream source without over writing your modifications. You should never make any changes to the Dollie templates inside the plugin, and always define your modifications in a child theme instead.
If you want to overwrite a template you simply need to copy over the template file you want to overwrite from the Dollie plugin into your Child Theme. For example if you'd like to modify the customer sites listing you would copy:
to
You can now make edits freely to that file in your child-theme folder.
There is a risk that a significant change to the templates in the hub plugin would be incompatible with your child-theme. This would happen where function names have changed, or the functions no longer exist. We make significant effort to maintain backwards compatibility. If a breaking change does occur, you may need to downgrade your version of the hub plugin until such time as the necessary changes can be made to the child-theme to make it compatible with the latest version.
What are child themes?
A WordPress child theme is a theme that inherits the functionality of another theme, called the parent theme, and allows you to modify, or add to, the functionality of that parent theme. The parent/child structure has been a very popular method to harness the power of WordPress themes because it allows you to modify the styling and layout of a parent theme without editing the files of the parent theme itself. This allows the parent theme to be updated from its upstream source without over writing your modifications. You should never make any changes to the Dollie templates inside the plugin, and always define your modifications in a child theme instead.
How do I overwrite the Dollie template pages?
If you want to overwrite a template you simply need to copy over the template file you want to overwrite from the Dollie plugin into your Child Theme. For example if you'd like to modify the customer sites listing you would copy:
dollie/templates/loop/sites.php
to
my-child-theme/dollie/loop/sites.php
You can now make edits freely to that file in your child-theme folder.
Will my child-theme break if the Hub plugin is updated?
There is a risk that a significant change to the templates in the hub plugin would be incompatible with your child-theme. This would happen where function names have changed, or the functions no longer exist. We make significant effort to maintain backwards compatibility. If a breaking change does occur, you may need to downgrade your version of the hub plugin until such time as the necessary changes can be made to the child-theme to make it compatible with the latest version.
Updated on: 27/02/2024
Thank you!