Last active
September 11, 2024 15:40
-
-
Save thekendog/69b28bd0bda0b949a909602173c2e95a to your computer and use it in GitHub Desktop.
Set Kadence Blocks colors to those from Blocksy theme.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Set the colors from Blocksy to match those of Kadence blocks | |
*/ | |
add_filter('kadence_blocks_pattern_global_colors', function($kadence_colors) { | |
if ( !function_exists('blocksy_get_theme_mod') ) { | |
return $kadence_colors; | |
} | |
$colorPalette = (array) blocksy_get_theme_mod('colorPalette'); | |
for ($i = 1; $i <= count($colorPalette); $i++) { | |
$kadence_colors['--global-palette' . $i] = $colorPalette['color' . $i]['color']; | |
} | |
$buttonTextColor = blocksy_get_theme_mod('buttonTextColor'); | |
$kadence_colors['--global-palette-btn'] = $buttonTextColor['default']['color'] ?? '#ffffff'; | |
$kadence_colors['--global-palette-btn-hover'] = $buttonTextColor['hover']['color'] ?? '#ffffff'; | |
$buttonColor = blocksy_get_theme_mod('buttonColor'); | |
$kadence_colors['--global-palette-btn-bg'] = $buttonColor['default']['color'] ?? $colorPalette['color1']['color']; | |
$kadence_colors['--global-palette-btn-bg-hover'] = $buttonColor['hover']['color'] ?? $colorPalette['color2']['color']; | |
return $kadence_colors; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment