Using Chap Child
Chap Child is the child theme of Chap. A child theme is a theme that inherits the functionality and styling of another theme, called the parent theme. Child themes are the recommended way of modifying an existing theme.
No, child theme still requires the parent theme to also be installed. See our tutorial on how to install Chap parent and child theme here.
Child theme’s functions.php
file is executed even before the parent theme’s functions.php
. You can use this file to add action hooks and filters. Since it’s a child theme, all the code will remain there after theme updates.
Custom CSS code can be added into this file and it will not be overwritten with theme updates. Custom CSS can also be added in the WordPress Customizer, with live preview, but keep in mind that this CSS will not be stored in any files, so when you move your child theme to a different host you will lose the custom styles unless you migrate the full database as well.
This file can be used to execute JavaScript on every page. The file already includes some structuring, which allows to reference jQuery by the $-sign and also add code that will be executed once the document is ready.
Copy any template file from the parent theme folder chap/templates/ here to override it and modify to your liking.
Copy any action-*.php file from the parent theme folder chap/lib/template-functions/ here to override it and modify to your liking.
Any php file with “action-” prefix will be automatically loaded.
Copy any widget-*.php file from the parent theme folder chap/lib/widgets/ here to override it and modify to your liking.
Any php file with “widget-” prefix will be automatically loaded.
namespace Chap\Widgets;
function the_widget_filter($widget_output, $props, $sidebar_id, $widget_type) {
return $widget_output;
}
add_filter('chap_widget_WIDGET_ID', __NAMESPACE__ . '\\the_widget_filter', 10, 4);