-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathcustomize-basic.php
91 lines (85 loc) · 2.62 KB
/
customize-basic.php
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
<?php
/*
customize_register
/*-------------------------------------------*/
add_action( 'customize_register', 'lightning_customize_register_basic' );
function lightning_customize_register_basic( $wp_customize ) {
$wp_customize->add_section(
'lightning_function',
array(
'title' => lightning_get_prefix_customize_panel() . __( 'Function Settings', 'lightning' ),
'priority' => 450,
)
);
// Generation Setting ////////////////////////////////////////.
$wp_customize->add_setting(
'generation_title',
array(
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
new VK_Custom_Html_Control(
$wp_customize,
'generation_title',
array(
'label' => __( 'Generation Setting', 'lightning' ),
'section' => 'lightning_function',
'type' => 'text',
'custom_title_sub' => '',
'custom_html' => '<p><span style="color:red;font-weight:bold;">' . __( 'Switch of generations is nearly switch of theme.', 'lightning' ) . '</span></p>' . '<p>' . __( 'Be sure to make a backup before switch of generation as it is not very compatible.', 'lightning' ) . '</p>',
'priority' => 2,
)
)
);
$choices = array(
'g2' => __( 'Generation 2 ( ~ version 13.x )', 'lightning' ),
'g3' => __( 'Generation 3', 'lightning' ),
);
if ( lightning_is_g3() ) {
$default = 'g3';
} else {
$default = 'g2';
}
$wp_customize->add_setting(
'lightning_theme_generation',
array(
'default' => $default,
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
'lightning_theme_generation',
array(
'label' => '',
'section' => 'lightning_function',
'settings' => 'lightning_theme_generation',
'type' => 'select',
'choices' => $choices,
'priority' => 2,
)
);
$wp_customize->add_setting(
'generation_reload_btn',
array(
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
new VK_Custom_Html_Control(
$wp_customize,
'generation_reload_btn',
array(
'label' => '',
'section' => 'lightning_function',
'type' => 'text',
'custom_title_sub' => '',
'custom_html' => '<p>' . __( 'After switching generations, save and reload the page.', 'lightning' ) . '</p><a href="' . esc_url( $_SERVER['REQUEST_URI'] ) . '" class="button button-primary button-block">' . __( 'Reload the page', 'lightning' ) . '</a>',
// 'active_callback' => 'lightning_generation_reload_callback',
'priority' => 2,
)
)
);
}