How do I add stuff to themes such as Arjuna-X without losing it when the theme is updated? Are child themes a good way to do it or are there other options? What if a new version of the theme comes out with native support for a feature I added?
Leave a Reply
You must be logged in to post a comment.
There are three ways to do this
Functions.php
Put your additions in functions.php and back up that file before you update your theme. Then you can port over any additions as necessary.
Child theme
Build a child theme that adds the functionality – in reality, this would be an even better way to use a custom functions.php file because it wouldn’t be overwritten by updates.
Custom plug-in
Completely isolate the new functionality from the theme and add it in using WordPress’ hooks and filters. This way, you lose nothing in upgrades and can selectively turn off features if/when native support is added by the themes.
My vote would go toward making a plug-in. Won’t be overwritten by theme updates, and you can re-use it on other WP sites. Writing plug-ins also helps one learn WordPress.
child themes is a great way, when yout feature a topic of the theme is; other is better as plugin. When you use a child theme, the is it great, when you use get_template_part() and not copy the complete template; its better for update the template and also use hooks for inlcude fetures in themes – better as the new template in the child theme; example. you will add a script to the head; use wp_enque_script or wp_head and not copy header.php in your child theme and add this in the code. When update the header.php in the basis-theme than wotks the update fine.