View file StuffPost/stuffpost/functions/customizer/colors-to-css-inject.php

File size: 6.07Kb
<?php
function weart_color_changer() {
    wp_enqueue_style( 'main-style', get_stylesheet_uri() );

    /*BEGIN THE COLORS */

      // MAIN COLOR
        $main_color = get_theme_mod( 'main_color', '#49c5b6' ); //E.g. #FF0000
        if( !empty($main_color) ){
          $main = "
                    .post-container .post-content blockquote:before, .post-container .comment-content blockquote:before,
                    .woocommerce .button:hover, .woocommerce #review_form #respond .form-submit input:hover,
                    .woocommerce .woocommerce-error:before, .woocommerce .woocommerce-info:before, .woocommerce .woocommerce-message:before,
                    .woocommerce div.product p.price,
                    .section-video .carousel-indicators li.active,
                    .lh-1 a:hover,
                    .l-1 a,
                    #llc_comments_button:hover, #submit:hover,
                    .c-1, ch-1:hover { color: $main_color !important }

                    .woocommerce span.onsale,
                    .format-video.itemInner:after, .format-video.itemGrid:after, .format-audio.itemInner:after, .format-audio.itemGrid:after, .format-gallery.itemInner:after, .format-gallery.itemGrid:after, .sticky.itemInner:after, .sticky.itemGrid:after,
                    .bgh-1:hover,
                    .sectionTitle span:before,
                    #llc_comments_button, #submit,
                    .bg-1 { background-color: $main_color !important }

                    .post-container .post-content a, .post-container .comment-content a,
                    .post-container .post-content blockquote,
                    .post-container .comment-content blockquote,
                    .archive-title,
                    .section-video .carousel-indicators li.active,
                    .post-container .lead:after,
                    .home-recommendation,
                    .video-post-header .lead:after,
                    .video-post,
                    .article-header,
                    #footer,
                    #llc_comments_button:hover, #submit:hover,
                    .brd-1{ border-color: $main_color !important }

                    .woocommerce .woocommerce-error, .woocommerce .woocommerce-info, .woocommerce .woocommerce-message { border-top-color: $main_color }

                    .itemInner:hover .title:before{ background: linear-gradient(to bottom, transparent 0%, $main_color 50%, $main_color 100%); }
                    .itemInner .bg:before{ background: linear-gradient(-45deg,#000, $main_color ); }
                    #footer .footer-content:after{ background: linear-gradient(to bottom, transparent, $main_color ); }
                    ";
          wp_add_inline_style( 'main-style', $main );
        };

      // META
        $meta_color = get_theme_mod( 'meta_color', '#b3c2bf' ); //E.g. #FF0000
        if( !empty($meta_color) ){
          $meta = "
                    .l-meta a, .lh-meta a:hover,
                    .woocommerce div.product .product_meta,
                    .widget_rss ul li .rss-date,
                    .c-meta,.ch-meta:hover { color: $meta_color !important; }

                    .woocommerce .price_slider.ui-widget-content,
                    .bg-meta,.bgh-meta:hover  { background-color: $meta_color !important; }

                    .brd-meta,
                    .post-content table td, .post-content table th, .comment-content table td, .comment-content table th { border-color: $meta_color !important }
                    ";
          wp_add_inline_style( 'main-style', $meta );
        };

      // BLACK COLOR
        $black_color = get_theme_mod( 'black_color', '#2a2a2a' ); //E.g. #FF0000
        if( !empty($black_color) ){
          $black = "
                    .l-black a,
                    .lh-black a:hover,
                    .woocommerce .page-title,
                    .woocommerce .button, .woocommerce #review_form #respond .form-submit input,
                    .woocommerce ul.products li.product .price,
                    .woocommerce .button, .woocommerce #review_form #respond .form-submit input,
                    .woocommerce ul.products li.product .price,
                    .c-black, .ch-black:hover { color: $black_color !important; }

                    .menu-mobile .mobile-menu-inner .social ul li,
                    .menu-mobile .mobile-menu-inner .items ul li a .hover,
                    .woocommerce .button:hover, .woocommerce #review_form #respond .form-submit input:hover,
                    .woocommerce .price_slider .ui-slider-range, .woocommerce .price_slider .ui-slider-handle,
                    .bgh-black:hover,
                    .bg-black { background-color: $black_color !important; }

                    .brd-black{border-color: $black_color !important;}
                    ";
          wp_add_inline_style( 'main-style', $black );
        };

      // WHITE-COLOR
        $white_color = get_theme_mod( 'white_color', '#FFF' ); //E.g. #FF0000
        if( !empty($white_color) ){
          $white = "
                    .l-white a,
                    .lh-white a:hover,
                    .format-video.itemInner:after, .format-video.itemGrid:after, .format-audio.itemInner:after, .format-audio.itemGrid:after, .format-gallery.itemInner:after, .format-gallery.itemGrid:after, .sticky.itemInner:after, .sticky.itemGrid:after,
                    .woocommerce span.onsale,
                    #llc_comments_button, #submit,
                    .c-white,.ch-white:hover { color: $white_color !important; }


                    .section-video .carousel-indicators li.active,
                    .bgh-white:hover,
                    .bg-white { background-color: $white_color !important; }

                    .section-video .carousel-indicators li.active:before {
                    border-color: transparent $white_color transparent transparent; }
                    ";
          wp_add_inline_style( 'main-style', $white );
        };

    /* END */
} add_action( 'wp_enqueue_scripts', 'weart_color_changer' );