Snippets: How To Properly Alter The WPEX_Theme_Setup Class (functions.php)

/**
 * Example showing how to properly remove actions and filters
 * from the main WPEX_Theme_Setup Class in the Total theme
 *
 * THIS IS AN EXAMPLE SHOWING HOW YOU PROPERLY REMOVE ACTIONS & FILTERS
 * DON'T JUST COPY/PASTE THIS INTO YOUR CHILD THEME FOR NO REASON ;)
 *
 */
/* Total 3.5.0 and greater */
function myprefix_alter_total_wpex_theme_class() {

	// Remove all theme addons + theme panel - omg!
	remove_action( 'after_setup_theme', array( 'WPEX_Theme_Setup', 'addons' ), 2 );

	// Remove custom password protection form
	remove_action( 'the_password_form', array( 'WPEX_Theme_Setup', 'custom_password_protected_form' ) );

	// Remove oembed responsive wraps
	remove_filter( 'embed_oembed_html', array( 'WPEX_Theme_Setup', 'add_responsive_wrap_to_oembeds' ), 99, 4 );

	// Remove user social options
	remove_filter( 'user_contactmethods', array( 'WPEX_Theme_Setup', 'add_user_social_fields' ) );

	// Remove gravity forms custom css
	remove_action( 'wp_enqueue_scripts', array( 'WPEX_Theme_Setup', 'gravity_forms_css' ), 40 );

}
add_action( 'after_setup_theme', 'myprefix_alter_total_wpex_theme_class', 0 );


/* Total 3.4.0 and under */
function myprefix_alter_total_wpex_theme_class() {

	// Get setup class
	global $wpex_theme_setup;

	// Remove all theme addons + theme panel - omg!
	remove_action( 'after_setup_theme', array( $wpex_theme_setup, 'addons' ), 2 );

	// Remove custom password protection form
	remove_action( 'the_password_form', array( $wpex_theme_setup, 'custom_password_protected_form' ) );

	// Remove oembed responsive wraps
	remove_filter( 'embed_oembed_html', array( $wpex_theme_setup, 'add_responsive_wrap_to_oembeds' ), 99, 4 );

	// Remove user social options
	remove_filter( 'user_contactmethods', array( $wpex_theme_setup, 'add_user_social_fields' ) );

	// Remove gravity forms custom css
	remove_action( 'wp_enqueue_scripts', array( $wpex_theme_setup, 'gravity_forms_css' ), 40 );

}
add_action( 'after_setup_theme', 'myprefix_alter_total_wpex_theme_class', 0 );

Snippet Type: PHP

Posted Under: Core

All PHP snippets should be added via a child theme's functions.php file.