Skip to content

Instantly share code, notes, and snippets.

@robertuniqid
Created January 29, 2022 21:30
Show Gist options
  • Save robertuniqid/c2045ad0bffb616d4d3f32e9fd92d38c to your computer and use it in GitHub Desktop.
Save robertuniqid/c2045ad0bffb616d4d3f32e9fd92d38c to your computer and use it in GitHub Desktop.
Elementor Color Element to CSS value
<?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