lugoazul
9/4/2017 - 12:30 PM

GP-Integrate EL Color Palettes with GP Customizer Palettes

GP - Integrate Elementor Color Palettes with GP Customizer Palettes From https://generatepress.com/forums/topic/integrate-elementor-color-palettes-with-gp-customizer-palettes/

<?php 

include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( is_plugin_active( 'elementor/elementor.php' && 'gp-premium/gp-premium.php' ) ) {

	add_filter( 'generate_default_color_palettes', 'elementor_global_color_palettes' );
	function elementor_global_color_palettes( $palettes ) {
		// Some pickers seem to require we start our array with key[0] so we use array_values.
		$scheme_colors = array_values( get_option( 'elementor_scheme_color' ) );
		$picker_colors = array_values( get_option( 'elementor_scheme_color-picker' ) );

		/***   YOU CAN ONLY HAVE ONE INSTANCE OF $palettes UNCOMMENTED  ***/

		/* **************************************************
		If you want all 12 colors from the Elementor Global Colors and Picker Colors   */

		//$palettes = array_merge( $scheme_colors, $picker_colors );

		/* **************************************************
		OR, If you have Elementor Global Colors disabled or just want the 8 colors from the Elementor Picker Colors   */

		//$palettes = $picker_colors ;

		/* **************************************************
		Or, re-order, mix and match, comment out the ones you don't want. */

		$palettes = array(
			$scheme_colors[3],
			$scheme_colors[1],
			$scheme_colors[2],
			$scheme_colors[0],
			//$picker_colors[0],
			//$picker_colors[1],
			//$picker_colors[2],
			//$picker_colors[3],
			$picker_colors[7],
			$picker_colors[5],
			$picker_colors[6],
			$picker_colors[4],
		);

		return $palettes;
	}
}