-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
268 lines (230 loc) · 11.8 KB
/
Copy pathfunctions.php
File metadata and controls
268 lines (230 loc) · 11.8 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
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<?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 ) );
//remove_filter( 'HEADER_IMAGE_WIDTH', 'twentyeleven_header_image_width' );
//define( 'HEADER_IMAGE_WIDTH', apply_filters( 'child_header_image_width', 230 ) );
//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 SHOWCASE TEMPLATE
$_templates_to_remove = array();
function remove_template( $files_to_delete = array() ){
if ( is_scalar( $files_to_delete ) ) $files_to_delete = array( $files_to_delete );
global $_templates_to_remove;
$_templates_to_remove = array_unique(array_merge($_templates_to_remove, $files_to_delete));
add_action('admin_print_footer_scripts', '_remove_template_footer_scripts');
}
function _remove_template_footer_scripts() {
global $_templates_to_remove;
if ( ! $_templates_to_remove ) { return; }
?>
<script type="text/javascript">
jQuery(function($) {
var tpls = <?php echo json_encode($_templates_to_remove); ?>;
$.each(tpls, function(i, tpl) {
$('select[name="page_template"] option[value="'+ tpl +'"]').remove();
});
});
</script>
<?php
}
add_action('admin_head-post.php', 'remove_parent_templates');
add_action('admin_head-post-new.php', 'remove_parent_templates');
function remove_parent_templates() {
remove_template(array(
'showcase.php'
));
}
// REMOVE SHOWCASE SIDEBAR
function remove_some_sidebar(){
unregister_sidebar( 'sidebar-2' );
}
add_action( 'widgets_init', 'remove_some_sidebar', 11 );
// MODIFY TWENTY ELEVEN EXCERPT LENGTH FILTER
remove_filter( 'excerpt_length', 'twentyeleven_excerpt_length' );
//add_filter('excerpt_length', 'new_excerpt_length');
//function new_excerpt_length($length) {
// return 50;
//}
// 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' => __( 'Gray Blocks', 'twentyeleven' ),
'thumbnail' => get_stylesheet_directory_uri() . '/images/theme-screenshots/gray-blocks.png',
'default_link_color' => '#a00'
);
$color_schemes['dark'] = array(
'value' => 'dark',
'label' => __( 'Black Background', 'twentyeleven' ),
'thumbnail' => get_stylesheet_directory_uri() . '/images/theme-screenshots/dark-new.png',
'default_link_color' => '#a00'
);
$color_schemes['classic'] = array(
'value' => 'classic',
'label' => __( 'Classic', 'twentyeleven' ),
'thumbnail' => get_stylesheet_directory_uri() . '/images/theme-screenshots/classic-new.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-new.png',
'default_link_color' => '#a00'
);
$color_schemes['beige'] = array(
'value' => 'beige',
'label' => __( 'Red Blocks', 'twentyeleven' ),
'thumbnail' => get_stylesheet_directory_uri() . '/images/theme-screenshots/red-blocks.png',
'default_link_color' => '#a00'
);
$color_schemes['fall'] = array(
'value' => 'fall',
'label' => __( 'Pale Gray Background', 'twentyeleven' ),
'thumbnail' => get_stylesheet_directory_uri() . '/images/theme-screenshots/pale-gray.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' );
// ADD CATEGORY FOR IMAGE PLAYER TOOL
function create_my_cat () {
if (file_exists (ABSPATH.'/wp-admin/includes/taxonomy.php')) {
require_once (ABSPATH.'/wp-admin/includes/taxonomy.php');
if ( ! get_cat_ID( 'Feature' ) ) {
wp_create_category( 'Feature' );
}
}
}
add_action ( 'after_setup_theme', 'create_my_cat' );
?>