HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ns3133907 6.8.0-86-generic #87-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 22 18:03:36 UTC 2025 x86_64
User: cssnetorguk (1024)
PHP: 8.2.28
Disabled: NONE
Upload Files
File: /home/countywedding.co.uk/public_html-20250117121004/wp-content/themes/business-roy/inc/dynamic.php
<?php
/**
 * Dynamic css
*/
function business_roy_convert_hex_to_rgba($hex){
    list($r, $g, $b) = sscanf($hex, "#%02x%02x%02x");
    return sprintf('%s, %s, %s', $r, $g, $b);
}

if (! function_exists('business_roy_dynamic_css')){
	function business_roy_dynamic_css(){

        $primary_color      = get_theme_mod('business_roy_primary_color');
        $widget_bg_color    = get_theme_mod('content_widget_background');
        
        $container_width    = get_theme_mod('business_roy_container_width');
        $sidebar_width      = get_theme_mod('business_roy_sidebar_width');

        $body_font          = get_theme_mod('body_font_family', 'Poppins');
        $heading_font       = get_theme_mod('heading_font_family', 'Poppins');

        $root = array();
        
        // $px = 70;
		$business_roy_dynamic = $business_roy_dynamic_tablet_style = $business_roy_dynamic_mobile_style = '';
        
        // Theme Primary Background Colors.
        if( $primary_color ){
            $rgb = business_roy_convert_hex_to_rgba($primary_color);
            $root[] = "--theme-color: {$primary_color};";
            $root[] = "--link-hover-color: {$primary_color};";
            $root[] = "--icon-color: {$primary_color};";
            $root[] = "--theme-rgb-color: {$rgb};";
        }

        if( $body_font ){
            $root[] = "--body-font: '{$body_font}',sans-serif";
        }

        if( $heading_font ){
            $root[] = "--title-font: '{$heading_font}',sans-serif";
        }

        if( $widget_bg_color ){
            $root[] = "--widget-bg-color: {$widget_bg_color};";
        }
        
        if( $container_width ){
            $root[] = "--container-width: {$container_width}px;";
        }

        if( $sidebar_width ){
            $root[] = "--sidebar-width: {$sidebar_width}px;";
        }

        $business_roy_dynamic .= ":root{" . implode(';', $root) . "}";

        /**
         * common section color
         */
        $home_sections = array('aboutus', 'service', 'video_calltoaction', 'calltoaction', 'counter', 'blog', 'testimonial', 'team', 'client', 'promoservice', 'titlebar', 'contact', 'pricing', 'tab', 'producttype', 'productcat', 'recentwork', 'how_it_works','titlebar');
        
        foreach($home_sections as $sectionname){

            $sectionclass = '#' . $sectionname . '-section';
            
            $sectionbgtype = get_theme_mod('business_roy_' . $sectionname . '_bg_type', 'color-bg');
                 
            $section_seperator = get_theme_mod("business_roy_{$sectionname}_section_seperator");

            $css = $css1 = array();
            if ($sectionbgtype == 'color-bg' || $sectionbgtype == 'image-bg') {
                $sectionbgcolor = get_theme_mod('business_roy_' . $sectionname . '_bg_color');
                $css[] = "background-color: $sectionbgcolor";
            }
 
            elseif ($sectionbgtype == 'gradient-bg') {
                $sectiongradientcolor = get_theme_mod('business_roy_' . $sectionname . '_bg_gradient');
                $css[] = "$sectiongradientcolor";
            }

            
            $business_roy_dynamic .= "$sectionclass{" . implode(';', $css) . "}";
            
            if( $css1 ){
                $business_roy_dynamic .= "$sectionclass::before{" . implode(';', $css1) . "}";
            }
  
            /**
             * Section Padding
             */
            $css = array();
            $section_padding = get_theme_mod("business_roy_{$sectionname}_padding");
            $section_padding = json_decode( $section_padding, true );
            
            if( $section_padding ){
                $padding = get_dynamic_padding_value($section_padding);
                $css[] = $padding['desktop'];
                // $tab_css.= $padding['tablet'];
                // $mobile_css.= $padding['mobile'];
            }
            $business_roy_dynamic .= "$sectionclass{" . implode(';', $css) . "}";

            /**
             * Section margin
             */
            $section_margin = get_theme_mod("business_roy_{$sectionname}_margin");
            $section_margin = json_decode( $section_margin, true );
            
            if( $section_margin ){
                $margin = get_dynamic_margin_value($section_margin);
                $css[] = $margin['desktop'];
                // $tab_css.= $padding['tablet'];
                // $mobile_css.= $padding['mobile'];
            }
            $business_roy_dynamic .= "$sectionclass{" . implode(';', $css) . "}";

        }

        /*********
         * Contact Section
         */
        $contact = business_roy_contact_dynamic_css();
        $business_roy_dynamic .= $contact['desktop'];

        /*********
         * Header Social ( Not Fixed)
        */
        $header = business_roy_dynamic_header_social_links_css();
        $business_roy_dynamic .= $header['desktop'];

        /********
         * Main Header  ( Not Fixed)
        */
        $header = business_roy_dynamic_header_css();
        $business_roy_dynamic .= $header['desktop'];
        
        /********
         * Header Button 
        */
        $header = business_roy_dynamic_header_button_css();
        $business_roy_dynamic .= $header['desktop'];
        
        /**********
         * Header Menu Style
        */
        $header = business_roy_dynamic_header_nav_css();
        if( isset( $header['desktop'] )){
            $business_roy_dynamic .= $header['desktop'];
        }
        /**** Sub Menu Item */
        $header = business_roy_dynamic_header_nav_sub_menu_css();
        if( isset( $header['desktop'] )){
            $business_roy_dynamic .= $header['desktop'];
        }
        /**** Active Menu Item */
        $header = business_roy_dynamic_header_nav_active_menu_css();
        if( isset( $header['desktop'] )){
            $business_roy_dynamic .= $header['desktop'];
        }

        /** slider */
        $header = business_roy_dynamic_slider_css();
        $business_roy_dynamic .= $header['desktop'];


        $header = business_roy_dynamic_slider_seprator_css();
        $business_roy_dynamic .= $header['desktop'];

        /** promo service */
        $header = business_roy_promoservice_dynamic_css();
        $business_roy_dynamic .= $header['desktop'];

        
        /** counter */
        $header = business_roy_counter_dynamic_css();
        $business_roy_dynamic .= $header['desktop'];

        /** team */
        $header = business_roy_team_dynamic_css();
        $business_roy_dynamic .= $header['desktop'];

        /** footer */
        $header = business_roy_dynamic_footer_css();
        $business_roy_dynamic .= $header['desktop'];
        

        /** breadcrumb */
        $header = business_roy_dynamic_breadcrub_css();
        $business_roy_dynamic .= $header['desktop'];

        $dynamic = '';
        $desktopCss = $tabletCss = $mobileCss = "";
        $value = apply_filters( 'business_roy_dynamic_css', array('desktop' => $desktopCss, 'tablet' => $tabletCss, 'mobile' => $mobileCss) );
       
        
        $dynamic .= $value['desktop'];
        $dynamic .= $business_roy_dynamic;
        

        $dynamic .= "@media screen and (max-width:768px){{$value['tablet']}}";
        $dynamic .= "@media screen and (max-width:480px){{$value['mobile']}}";

        
        wp_add_inline_style( 'business-roy-style', $dynamic );
	}
}
add_action( 'wp_enqueue_scripts', 'business_roy_dynamic_css', 999 );