1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
/**
* Divi Customizer Enhancements
* Estende le opzioni del Customizer per setup enterprise
*/
function divi_enterprise_customizer( $wp_customize ) {
// Sezione Brand Identity
$wp_customize->add_section( 'divi_brand_identity', array(
'title' => 'Brand Identity',
'description' => 'Configurazioni brand per coerenza aziendale',
'priority' => 30,
));
// Primary Brand Color
$wp_customize->add_setting( 'divi_brand_primary_color', array(
'default' => '#2EA3F2',
'sanitize_callback' => 'sanitize_hex_color',
));
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'divi_brand_primary_color', array(
'label' => 'Colore Primario Brand',
'section' => 'divi_brand_identity',
'settings' => 'divi_brand_primary_color',
)));
// Secondary Brand Color
$wp_customize->add_setting( 'divi_brand_secondary_color', array(
'default' => '#f7f7f7',
'sanitize_callback' => 'sanitize_hex_color',
));
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'divi_brand_secondary_color', array(
'label' => 'Colore Secondario Brand',
'section' => 'divi_brand_identity',
'settings' => 'divi_brand_secondary_color',
)));
// Font Primario
$wp_customize->add_setting( 'divi_brand_font_primary', array(
'default' => 'Open Sans',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control( 'divi_brand_font_primary', array(
'label' => 'Font Primario',
'section' => 'divi_brand_identity',
'type' => 'select',
'choices' => array(
'Open Sans' => 'Open Sans',
'Raleway' => 'Raleway',
'Montserrat' => 'Montserrat',
'Poppins' => 'Poppins',
'Roboto' => 'Roboto',
'Lato' => 'Lato',
),
));
// Company Tagline
$wp_customize->add_setting( 'divi_company_tagline', array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control( 'divi_company_tagline', array(
'label' => 'Tagline Aziendale',
'section' => 'divi_brand_identity',
'type' => 'text',
'description' => 'Tagline che appare sotto il logo',
));
}
add_action( 'customize_register', 'divi_enterprise_customizer' );
/**
* Output CSS personalizzato basato su Customizer
*/
function divi_enterprise_customizer_css() {
$primary_color = get_theme_mod( 'divi_brand_primary_color', '#2EA3F2' );
$secondary_color = get_theme_mod( 'divi_brand_secondary_color', '#f7f7f7' );
$primary_font = get_theme_mod( 'divi_brand_font_primary', 'Open Sans' );
?>
<style type="text/css" id="divi-enterprise-customizer-css">
:root {
--brand-primary: <?php echo esc_attr( $primary_color ); ?>;
--brand-secondary: <?php echo esc_attr( $secondary_color ); ?>;
--brand-font: '<?php echo esc_attr( $primary_font ); ?>', sans-serif;
}
/* Applica colori brand */
.et_pb_button,
.et_pb_promo_button,
.et_pb_more_button {
background-color: var(--brand-primary) !important;
}
.et_pb_button:hover,
.et_pb_promo_button:hover,
.et_pb_more_button:hover {
background-color: var(--brand-secondary) !important;
color: var(--brand-primary) !important;
}
/* Applica font brand */
body,
.et_pb_module h1, .et_pb_module h2, .et_pb_module h3,
.et_pb_module h4, .et_pb_module h5, .et_pb_module h6 {
font-family: var(--brand-font);
}
/* Accent colors */
.et_pb_contact_submit,
.et_pb_newsletter_button,
.et_pb_blog_grid .et_pb_post .post-meta a,
#main-header .nav li ul a:hover,
.et_pb_filterable_portfolio .et_pb_portfolio_filters li a.active,
.et_pb_filterable_portfolio .et_pb_portofolio_pagination ul li a.active,
.et_pb_gallery .et_pb_gallery_pagination ul li a.active {
background-color: var(--brand-primary);
}
/* Links e accenti */
a,
.et_pb_module a,
.et_pb_text_align_left a,
.et_pb_member_social_links a:hover,
.et_pb_pricing li.et_pb_not_available_item {
color: var(--brand-primary);
}
</style>
<?php
}
add_action( 'wp_head', 'divi_enterprise_customizer_css' );
|