-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
95 lines (75 loc) · 2.12 KB
/
functions.php
File metadata and controls
95 lines (75 loc) · 2.12 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
<?php
/**
* Load theme styles.
*/
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style', get_stylesheet_uri(), array( 'parent-style' ) );
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
//------------------------------------------------------------------------------------------------------------------
/**
* Register js for Customize live preview.
*/
function theme_customize_preview_js() {
wp_enqueue_script( 'customize_preview_js', get_stylesheet_directory_uri() . '/js/customize.js', array( 'customize-preview', 'jquery' ) );
}
add_action( 'customize_preview_init', 'theme_customize_preview_js' );
/**
* Register my settings for customizer.
*
* @param $wp_customize
*/
function theme_customize_register( $wp_customize ) {
/**
* Add a Setting to Title section
*/
$wp_customize->add_setting( 'author_name', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'theme_supports' => '',
'default' => '',
'transport' => 'postMessage',
)
);
$wp_customize->add_control( 'author_name', array(
'type' => 'text',
'section' => 'title_tagline',
'label' => __( 'The blog author name' ),
'description' => __( 'Write here the author name of the blog.' ),
)
);
/**
* A checkbox to show/hide the Author name.
*/
$wp_customize->add_setting( 'show_author_name', array(
'default' => 'true',
'transport' => 'postMessage',
)
);
$wp_customize->add_control( 'show_author_name', array(
'type' => 'checkbox',
'label' => __( 'Show author name in header' ),
'section' => 'title_tagline',
)
);
/**
* Add an Author photo.
*/
$wp_customize->add_setting( 'photo_upload', array(
'transport' => 'refresh',
)
);
$wp_customize->add_control( new WP_Customize_Image_Control(
$wp_customize,
'photo_upload',
array(
'label' => __( 'Photo upload' ),
'section' => 'title_tagline',
'settings' => 'photo_upload'
)
)
);
}
add_action( 'customize_register', 'theme_customize_register' );
/* EOF */