This repository was archived by the owner on Jul 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcustomizer.php
More file actions
executable file
·122 lines (102 loc) · 3.43 KB
/
customizer.php
File metadata and controls
executable file
·122 lines (102 loc) · 3.43 KB
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
<?php
/**
*
* Adds the Customizer and options to Appearance -> Customize.
*
* @package Verb
* @since Verb 1.0
*/
add_action( 'customize_register', 'verb_customizer_register' );
function verb_customizer_register( $wp_customize ) {
class Verb_Customize_Textarea_Control extends WP_Customize_Control {
public $type = 'textarea';
public function render_content() {
?>
<label>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<textarea rows="5" style="width:100%;" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea>
</label>
<?php
}
}
// Live preview
if ( $wp_customize->is_preview() && ! is_admin() ) {
add_action( 'wp_footer', 'verb_customize_preview', 21);
}
function verb_customize_preview() {
?>
<script type="text/javascript">
( function( $ ) {
// Homepage title preview
wp.customize('verb_customizer_blocks_title',function( value ) {
value.bind(function(to) {
$('.hero h2').html(to);
});
});
// Homepage subtitle preview
wp.customize('verb_customizer_blocks_subtitle',function( value ) {
value.bind(function(to) {
$('.hero h3').html(to);
});
});
// Accent color
wp.customize('verb_customizer_accent',function( value ) {
value.bind(function(to) {
$('.hero h3').css('background-color', to );
});
});
} )( jQuery )
</script>
<?php
}
//Verb Style Options
$wp_customize->add_section( 'verb_customizer_basic', array(
'title' => __( 'Theme Options', 'verb' ),
'priority' => 1
) );
//Logo Image
$wp_customize->add_setting( 'verb_customizer_logo', array() );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'verb_customizer_logo', array(
'label' => __( 'Logo Upload', 'verb' ),
'section' => 'verb_customizer_basic',
'settings' => 'verb_customizer_logo'
) ) );
//Accent Color
$wp_customize->add_setting( 'verb_customizer_accent', array(
'default' => '#F74F4F',
'transport' => 'postMessage'
) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'verb_customizer_accent', array(
'label' => __( 'Accent Color', 'verb' ),
'section' => 'verb_customizer_basic',
'settings' => 'verb_customizer_accent'
) ) );
//Block Titles
$wp_customize->add_setting( 'verb_customizer_blocks_title', array(
'default' => '',
'transport' => 'postMessage'
) );
$wp_customize->add_control( 'verb_customizer_blocks_title', array(
'label' => __( 'Blocks Title', 'verb' ),
'section' => 'verb_customizer_basic',
'type' => 'text',
) );
$wp_customize->add_setting( 'verb_customizer_blocks_subtitle', array(
'default' => '',
'transport' => 'postMessage'
) );
$wp_customize->add_control( 'verb_customizer_blocks_subtitle', array(
'label' => __( 'Blocks Subtitle', 'verb' ),
'section' => 'verb_customizer_basic',
'type' => 'text',
) );
//Custom CSS
$wp_customize->add_setting( 'verb_customizer_css', array(
'default' => '',
) );
$wp_customize->add_control( new Verb_Customize_Textarea_Control( $wp_customize, 'verb_customizer_css', array(
'label' => __( 'Custom CSS', 'verb' ),
'section' => 'verb_customizer_basic',
'settings' => 'verb_customizer_css',
) ) );
}