-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions.php
205 lines (185 loc) · 10.1 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?php
// CHANGE THE HEADER HEIGHT
// Add a filter to twentyeleven_header_image_width and twentyeleven_header_image_height to change these values.
define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyeleven_header_image_width', 1000 ) );
//define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyeleven_header_image_height', 288 ) );
remove_filter( 'HEADER_IMAGE_HEIGHT', 'twentyeleven_header_image_height' );
define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'child_header_image_height', 230 ) );
// REMOVE TWENTY ELEVEN BACKGROUND OPTIONS
add_action( 'after_setup_theme','remove_twentyeleven_options', 100 );
function remove_twentyeleven_options() {
remove_custom_background();
//remove_custom_image_header();
}
// REMOVE TWENTY ELEVEN DEFAULT HEADER IMAGES
function wptips_remove_header_images() {
unregister_default_headers( array('wheel','shore','trolley','pine-cone','chessboard','lanterns','willow','hanoi')
);
}
add_action( 'after_setup_theme', 'wptips_remove_header_images', 11 );
//ADD NEW DEFAULT HEADER IMAGES
function wptips_new_default_header_images() {
$child2011_dir = get_bloginfo('stylesheet_directory');
register_default_headers( array (
'1911' => array (
'url' => "$child2011_dir/images/headers/1911.jpg",
'thumbnail_url' => "$child2011_dir/images/headers/1911-thumbnail.jpg", // 230 x 53px
'description' => __( '1911 Building', 'child2011' )
), // if you have more than one image you will need a comma between all of them, except for the last one
'belltower' => array (
'url' => "$child2011_dir/images/headers/belltower.jpg",
'thumbnail_url' => "$child2011_dir/images/headers/belltower-thumbnail.jpg", // 230 x 53px
'description' => __( 'NCSU Belltower', 'child2011' )
), // if you have more than one image you will need a comma between all of them, except for the last one
'bike' => array (
'url' => "$child2011_dir/images/headers/bike.jpg",
'thumbnail_url' => "$child2011_dir/images/headers/bike-thumbnail.jpg", // 230 x 53px
'description' => __( 'Bike in snow on campus', 'child2011' )
), // if you have more than one image you will need a comma between all of them, except for the last one
'fox' => array (
'url' => "$child2011_dir/images/headers/fox.jpg",
'thumbnail_url' => "$child2011_dir/images/headers/fox-thumbnail.jpg", // 230 x 53px
'description' => __( 'Mary Anne Fox Courtyard', 'child2011' )
), // if you have more than one image you will need a comma between all of them, except for the last one
'gregg' => array (
'url' => "$child2011_dir/images/headers/gregg-garden.jpg",
'thumbnail_url' => "$child2011_dir/images/headers/gregg-garden-thumbnail.jpg", // 230 x 53px
'description' => __( 'Garden behind Gregg Museum', 'child2011' )
), // if you have more than one image you will need a comma between all of them, except for the last one
'hillsborough' => array (
'url' => "$child2011_dir/images/headers/hillsborough.jpg",
'thumbnail_url' => "$child2011_dir/images/headers/hillsborough-thumbnail.jpg", // 230 x 53px
'description' => __( 'Hillsborough Street', 'child2011' )
), // if you have more than one image you will need a comma between all of them, except for the last one
'holladay' => array (
'url' => "$child2011_dir/images/headers/holladay.jpg",
'thumbnail_url' => "$child2011_dir/images/headers/holladay-thumbnail.jpg", // 230 x 53px
'description' => __( 'Holladay Hall', 'child2011' )
), // if you have more than one image you will need a comma between all of them, except for the last one
'leazar' => array (
'url' => "$child2011_dir/images/headers/leazar.jpg",
'thumbnail_url' => "$child2011_dir/images/headers/leazar-thumbnail.jpg", // 230 x 53px
'description' => __( 'Leazar Building', 'child2011' )
), // if you have more than one image you will need a comma between all of them, except for the last one
'spring' => array (
'url' => "$child2011_dir/images/headers/spring.jpg",
'thumbnail_url' => "$child2011_dir/images/headers/spring-thumbnail.jpg", // 230 x 53px
'description' => __( 'Spring on campus', 'child2011' )
), // if you have more than one image you will need a comma between all of them, except for the last one
'spring-hall' => array (
'url' => "$child2011_dir/images/headers/spring-hall.jpg",
'thumbnail_url' => "$child2011_dir/images/headers/spring-hall-thumbnail.jpg", // 230 x 53px
'description' => __( 'Building in spring', 'child2011' )
), // if you have more than one image you will need a comma between all of them, except for the last one
'statue' => array (
'url' => "$child2011_dir/images/headers/statue.jpg",
'thumbnail_url' => "$child2011_dir/images/headers/statue-thumbnail.jpg", // 230 x 53px
'description' => __( 'Walking professor statue', 'child2011' )
), // if you have more than one image you will need a comma between all of them, except for the last one
'swing' => array (
'url' => "$child2011_dir/images/headers/swing.jpg",
'thumbnail_url' => "$child2011_dir/images/headers/swing-thumbnail.jpg", // 230 x 53px
'description' => __( 'Swing in front of a residence hall', 'child2011' )
), // if you have more than one image you will need a comma between all of them, except for the last one
'tunnel' => array (
'url' => "$child2011_dir/images/headers/tunnel.jpg",
'thumbnail_url' => "$child2011_dir/images/headers/tunnel-thumbnail.jpg", // 230 x 53px
'description' => __( 'Free Expression Tunnel decorated for Google', 'child2011' )
), // if you have more than one image you will need a comma between all of them, except for the last one
'winston' => array (
'url' => "$child2011_dir/images/headers/winston.jpg",
'thumbnail_url' => "$child2011_dir/images/headers/winston-thumbnail.jpg", // 230 x 53px
'description' => __( 'Winston Hall', 'child2011' )
) // if you have more than one image you will need a comma between all of them, except for the last one
));
}
add_action( 'after_setup_theme', 'wptips_new_default_header_images' );
// REMOVE TWENTYELEVEN DARK.CSS
add_action( 'wp_enqueue_scripts', 'my_dark_css', 20);
function my_dark_css() {
wp_dequeue_style('dark');
//wp_enqueue_style('my-dark', get_stylesheet_directory_uri() . '/colors/dark.css', array(), null );
}
// SETUP ALTERNATIVE COLOR SCHEMES
add_filter('twentyeleven_color_schemes', 'ncsubrand_color_scheme');
add_action( 'twentyeleven_enqueue_color_scheme', 'ncsubrand_enqueue_color_scheme' );
function ncsubrand_color_scheme($color_schemes) {
$color_schemes['light'] = array(
'value' => 'light',
'label' => __( 'Light', 'twentyeleven' ),
'thumbnail' => get_stylesheet_directory_uri() . '/images/theme-screenshots/light.png',
'default_link_color' => '#a00'
);
$color_schemes['dark'] = array(
'value' => 'dark',
'label' => __( 'Dark', 'twentyeleven' ),
'thumbnail' => get_stylesheet_directory_uri() . '/images/theme-screenshots/dark.png',
'default_link_color' => '#a00'
);
$color_schemes['classic'] = array(
'value' => 'classic',
'label' => __( 'Classic', 'twentyeleven' ),
'thumbnail' => get_stylesheet_directory_uri() . '/images/theme-screenshots/classic.png',
'default_link_color' => '#a00'
);
$color_schemes['classic-dark'] = array(
'value' => 'classic-dark',
'label' => __( 'Classic Dark', 'twentyeleven' ),
'thumbnail' => get_stylesheet_directory_uri() . '/images/theme-screenshots/classic-dark.png',
'default_link_color' => '#a00'
);
$color_schemes['beige'] = array(
'value' => 'beige',
'label' => __( 'Beige', 'twentyeleven' ),
'thumbnail' => get_stylesheet_directory_uri() . '/images/theme-screenshots/beige.png',
'default_link_color' => '#a00'
);
$color_schemes['fall'] = array(
'value' => 'fall',
'label' => __( 'Fall', 'twentyeleven' ),
'thumbnail' => get_stylesheet_directory_uri() . '/images/theme-screenshots/fall.png',
'default_link_color' => '#a00'
);
return $color_schemes;
}
function ncsubrand_enqueue_color_scheme( $color_scheme ) {
// Light
if ( 'light' == $color_scheme )
wp_enqueue_style( 'light', get_stylesheet_directory_uri() . '/colors/light.css', array(), null );
// Dark - pulls from child theme
elseif ( 'dark' == $color_scheme )
wp_enqueue_style( 'my-dark', get_stylesheet_directory_uri() . '/colors/dark.css', array(), null );
// Classic
elseif ( 'classic' == $color_scheme )
wp_enqueue_style( 'classic', get_stylesheet_directory_uri() . '/colors/classic.css', array(), null );
// Classic Dark
elseif ( 'classic-dark' == $color_scheme )
wp_enqueue_style( 'classic-dark', get_stylesheet_directory_uri() . '/colors/classic-dark.css', array(), null );
// Beige
elseif ( 'beige' == $color_scheme )
wp_enqueue_style( 'beige', get_stylesheet_directory_uri() . '/colors/beige.css', array(), null );
// Fall
if ( 'fall' == $color_scheme )
wp_enqueue_style( 'fall', get_stylesheet_directory_uri() . '/colors/fall.css', array(), null );
}
// ADD ALTERNATE SIDEBAR OPTION; CALLS AFTER ALL OTHER SIDEBARS HAVE BEEN LOADED
function self_deprecating_sidebar_registration(){
register_sidebar( array(
'name' => __( 'Alternate Sidebar' ),
'id' => 'sidebar-6',
'description' => __( 'The sidebar for the optional Sidebar Template' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
add_action( 'wp_loaded', 'self_deprecating_sidebar_registration' );
// THEME UPDATES
//Initialize the update checker.
require 'theme-updates/theme-update-checker.php';
$example_update_checker = new ThemeUpdateChecker(
'oitflex',
'http://resources.wordpress.ncsu.edu/oitflex/info.json'
);
?>