Skip to content

Snippet: Add a New Built-In Button Color Option

The Total theme includes various built-in color accents to choose from for buttons. If you need to add custom options you can hook into the theme's filter to add new settings. See the example below. This will add the new option, but it's up to you to add the custom CSS for your custom color. You can check out Total/sass/main/core/_buttons.scss to see how the default colors are created if needed.

add_filter( 'wpex_get_accent_colors', function( $accents ) {
	$accents['teal_2'] = array(
		'label' => __( 'Teal 2', 'total' ),
		'hex'   => '#459dae',
	);
	return $accents;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top