-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathfunctions.php
121 lines (111 loc) · 3.01 KB
/
functions.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
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
<?php
/**
* Intentionally Blank Theme functions
*
* @package WordPress
* @subpackage intentionally-blank
*/
if ( ! function_exists( 'blank_setup' ) ) :
/**
* Sets up theme defaults and registers the various WordPress features that
* this theme supports.
*/
function blank_setup() {
load_theme_textdomain( 'intentionally-blank' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
// This theme allows users to set a custom background.
add_theme_support(
'custom-background',
array(
'default-color' => 'f5f5f5',
)
);
add_theme_support( 'custom-logo' );
add_theme_support(
'custom-logo',
array(
'height' => 256,
'width' => 256,
'flex-height' => true,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
)
);
}
endif; // end function_exists blank_setup.
add_action( 'after_setup_theme', 'blank_setup' );
remove_action( 'wp_head', '_custom_logo_header_styles' );
if ( ! is_admin() ) {
add_action(
'wp_enqueue_scripts',
function() {
wp_dequeue_style( 'global-styles' );
wp_dequeue_style( 'classic-theme-styles' );
wp_dequeue_style( 'wp-block-library' );
}
);
}
/**
* Sets up theme defaults and registers the various WordPress features that
* this theme supports.
* @param class $wp_customize Customizer object.
*/
function blank_customize_register( $wp_customize ) {
$wp_customize->remove_section( 'static_front_page' );
$wp_customize->add_section(
'blank_footer',
array(
'title' => __( 'Footer', 'intentionally-blank' ),
'priority' => 120,
'capability' => 'edit_theme_options',
'panel' => '',
)
);
$wp_customize->add_setting(
'blank_copyright',
array(
'type' => 'theme_mod',
'default' => __( 'Intentionally Blank - Proudly powered by WordPress', 'intentionally-blank' ),
'sanitize_callback' => 'wp_kses_post',
)
);
/**
* Checkbox sanitization function
* @param bool $checked Whether the checkbox is checked.
* @return bool Whether the checkbox is checked.
*/
function blank_sanitize_checkbox( $checked ) {
// Returns true if checkbox is checked.
return ( ( isset( $checked ) && true === $checked ) ? true : false );
}
$wp_customize->add_setting(
'blank_show_copyright',
array(
'default' => true,
'sanitize_callback' => 'blank_sanitize_checkbox',
)
);
$wp_customize->add_control(
'blank_copyright',
array(
'type' => 'textarea',
'label' => __( 'Copyright Text', 'intentionally-blank' ),
'section' => 'blank_footer',
'settings' => 'blank_copyright',
'priority' => '10',
)
);
$wp_customize->add_control(
'blank_footer_copyright_hide',
array(
'type' => 'checkbox',
'label' => __( 'Show footer with copyright Text', 'intentionally-blank' ),
'section' => 'blank_footer',
'settings' => 'blank_show_copyright',
'priority' => '20',
)
);
}
add_action( 'customize_register', 'blank_customize_register', 100 );