Snippets: How to Override Custom Widgets

You can override any of the Total theme's custom widgets via your child theme. Simply copy the widget file from the parent theme located at Total/framework/classes/widgets/ into your child theme (best to create a widgets folder in the child theme and add them there). Then you need to include the file hooked into the widgets_init file like the example below.

// Remove custom widget from loading inside the theme
add_filter( 'wpex_custom_widgets', function( $widgets ) {
   unset( $widgets['posts-thumbnails'] ); // Remove post thumbnails widget - the name is the same as the file "slug"
   return $widgets;
} );

// Load custom widget file from child theme
function myprefix_include_custom_widgets() {
	require_once( get_stylesheet_directory(). '/widgets/posts-thumbnails.php' );
add_action( 'widgets_init', 'myprefix_include_custom_widgets', 1 ); // use priority 1 to override parent
All PHP snippets should be added via a child theme's functions.php file.