Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Use Category Color for Divider Elementor Color*/
- function use_category_color_for_divider_elementor_elements() {
- if ( is_single() ) {
- $id_post = get_the_ID();
- $primary_cat_id = jnews_get_primary_category( $id_post );
- $category_color = null;
- if ( get_option( 'jnews_category_category_override_color' )[ $primary_cat_id ] ) {
- $category_color = get_option( 'jnews_category_category_bg_color' );
- }
- if ( get_theme_mod( 'jnews_category_override_color_' . $primary_cat_id ) ) {
- $category_color = get_theme_mod( 'jnews_category_color_' . $primary_cat_id );
- }
- if ( ! empty( $category_color[ $primary_cat_id ] ) || ! empty( $category_color ) ) {
- ?>
- <style scoped>
- .elementor-element {
- --divider-color: <?php echo ( is_array( $category_color ) ? $category_color[ $primary_cat_id ] : $category_color ); ?>!important;
- }
- </style>
- <?php
- }
- }
- }
- add_action( 'wp_head', 'use_category_color_for_divider_elementor_elements' );
Add Comment
Please, Sign In to add comment