Created
January 29, 2022 21:30
-
-
Save robertuniqid/c2045ad0bffb616d4d3f32e9fd92d38c to your computer and use it in GitHub Desktop.
Elementor Color Element to CSS value
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
<?php | |
function _lorem_ipsum_setting_to_css_variable_color( $settings, $index ) { | |
if( isset( $settings[ '__globals__' ] ) && isset( $settings[ '__globals__' ][ $index ] ) ) { | |
if( strpos( $settings[ '__globals__' ][ $index ],'?id=' ) !== false ) { | |
$identifier = substr( $settings[ '__globals__' ][ $index ], strpos( $settings[ '__globals__' ][ $index ],'?id=' ) + 4 ); | |
return 'var( --e-global-color-' . $identifier . ' )'; | |
} | |
} | |
if( isset( $settings[ $index ] ) ) | |
return $settings[ $index ]; | |
return 'inherit'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment