This repository has been archived by the owner on Aug 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
138 lines (120 loc) · 2.95 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
/**
* Theme functions and definitions
*
* @package Buntu
*/
/**
* Load styles.
*
* @since 1.0.0
*/
function buntu_enqueue_styles() {
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
wp_enqueue_script( 'buntu-custom', get_stylesheet_directory_uri() . '/js/custom' . $min . '.js', array( 'jquery' ), '1.6.0', true );
}
add_action( 'wp_enqueue_scripts', 'buntu_enqueue_styles' );
/**
* Setup stuffs.
*
* @since 1.0.0
*/
function buntu_theme_setup() {
unregister_default_headers(
array(
'horizon',
'orange-burn',
'planets-blue',
'planet-burst',
'space-splatters',
)
);
}
add_action( 'after_setup_theme', 'buntu_theme_setup', 20 );
/**
* Primary color.
*
* @since 1.0.0
*
* @param string $color Primary color value.
* @return string Modified color.
*/
function buntu_color_primary_default( $color ) {
return $color ? $color : '230d5b';
}
add_filter( 'theme_mod_color_primary', 'buntu_color_primary_default' );
/**
* Custom header.
*
* @since 1.0.0
*/
function buntu_custom_header() {
add_theme_support(
'custom-header',
array(
'default-image' => '%2$s/images/headers/beautiful-model.jpg',
'random-default' => false,
'width' => 1175,
'height' => 400,
'flex-width' => true,
'flex-height' => true,
'default-text-color' => '230d5b',
'header-text' => true,
'uploads' => true,
'wp-head-callback' => 'stargazer_custom_header_wp_head',
)
);
register_default_headers(
array(
'beautiful-model' => array(
'url' => '%2$s/images/headers/beautiful-model.jpg',
'thumbnail_url' => '%2$s/images/headers/beautiful-model-thumb.jpg',
// Translators: Header image description.
'description' => esc_html__( 'Beautiful Model', 'buntu' ),
),
)
);
}
add_action( 'after_setup_theme', 'buntu_custom_header' );
/**
* Register nav menus.
*
* @since 1.0.0
*/
function buntu_register_menus() {
register_nav_menu( 'footer', esc_html_x( 'Footer', 'nav menu location', 'buntu' ) );
}
add_action( 'init', 'buntu_register_menus', 11 );
/**
* Go to top.
*
* @since 1.0.0
*/
function buntu_add_goto_top() {
echo '<a href="#container" class="scrollup" id="btn-scrollup"><span class="screen-reader-text">' . esc_html__( 'Go to top', 'buntu' ) . '</span></a>';
}
add_action( 'wp_footer', 'buntu_add_goto_top' );
/**
* Load widgets.
*/
require get_stylesheet_directory() . '/inc/widgets.php';
/**
* Load Jetpack.
*/
require get_stylesheet_directory() . '/inc/jetpack.php';
/**
* Adds support for the WordPress 'custom-background' theme feature.
*
* @since 1.0.0
*/
function buntu_custom_background_setup() {
add_theme_support(
'custom-background',
array(
'default-color' => '6b269d',
'default-image' => get_stylesheet_directory_uri() . '/images/bg.jpg',
'wp-head-callback' => 'stargazer_custom_background_callback',
)
);
}
add_action( 'after_setup_theme', 'buntu_custom_background_setup', 10 );