-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
executable file
·281 lines (249 loc) · 9.46 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
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
269
270
271
272
273
274
275
276
277
278
279
280
<?php
if ( ! function_exists( 'oneill_setup' ) ):
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*
* @since Shape 1.0
*/
function boxing_setup() {
require_once('assets/wp_bootstrap_navwalker.php');
/**
* Add default posts and comments RSS feed links to head
*/
add_theme_support( 'automatic-feed-links' );
/**
* Enable support for the Aside Post Format
*/
add_theme_support( 'post-formats', array( 'aside' ) );
// add post-formats to post_type 'page'
add_post_type_support( 'page', 'post-formats' );
/**
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'main_menu' ),
) );
}
endif; // oneill_setup
add_action( 'after_setup_theme', 'boxing_setup' );
function wpbootstrap_scripts_with_jquery()
{
wp_register_script( 'bootstrap-js', get_template_directory_uri() . '/bootstrap/js/bootstrap.js', array( 'jquery' ) );
wp_register_script( 'jQuery-Knob', get_template_directory_uri() . '/assets/js/jQuery-Knob/js/jquery.knob.js', array( 'jquery' ) );
wp_register_script( 'wcb', get_template_directory_uri() . '/assets/js/wcb.js', array( 'jquery' ) );
// For either a plugin or a theme, you can then enqueue the script:
wp_enqueue_script( 'bootstrap-js' );
wp_enqueue_script( 'jQuery-Knob' );
wp_enqueue_script( 'wcb' );
wp_enqueue_style(get_template_directory_uri() . '/assets/css/wcb.css');
}
add_action( 'wp_enqueue_scripts', 'wpbootstrap_scripts_with_jquery' );
function arphabet_widgets_init() {
register_sidebar( array(
'name' => 'Countdown Area',
'id' => 'countdown_area',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2 class="rounded">',
'after_title' => '</h2>',
) );
}
function donate_widgets_init() {
register_sidebar( array(
'name' => 'Homepage Donate Area',
'id' => 'donate_area',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'donate_widgets_init' );
add_action( 'widgets_init', 'arphabet_widgets_init' );
function twitter_widgets_init() {
register_sidebar( array(
'name' => 'Twitter Area',
'id' => 'twitter_area',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'twitter_widgets_init' );
// Add Boxer Custom Post Type
add_action( 'init', 'register_cpt_boxer' );
function register_cpt_boxer() {
$labels = array(
'name' => _x( 'boxers', 'boxer' ),
'singular_name' => _x( 'boxer', 'boxer' ),
'all_items' => __( 'All Boxers', 'boxer' ),
'add_new' => _x( 'Add New', 'boxer' ),
'add_new_item' => _x( 'Add New boxer', 'boxer' ),
'edit_item' => _x( 'Edit boxer', 'boxer' ),
'new_item' => _x( 'New boxer', 'boxer' ),
'view_item' => _x( 'View boxer', 'boxer' ),
'search_items' => _x( 'Search boxers', 'boxer' ),
'not_found' => _x( 'No boxers found', 'boxer' ),
'not_found_in_trash' => _x( 'No boxers found in Trash', 'boxer' ),
'parent_item_colon' => _x( 'Parent boxers:', 'boxer' ),
'menu_name' => _x( 'Boxers', 'boxer' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'revisions', 'custom-fields', 'page-attributes' ),
'taxonomies' => array( 'category', 'post_tag', 'page-category'),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'public' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
'capability_type' => 'page'
);
register_post_type( 'boxer', $args );
};
add_filter( 'cmb_meta_boxes', 'cmb_sample_metaboxes' );
function cmb_sample_metaboxes( array $meta_boxes ) {
// Start with an underscore to hide fields from custom fields list
$prefix = '_cmb_';
/**
* Sample metabox to demonstrate each field type included
*/
$meta_boxes['boxer_one_metabox'] = array(
'id' => 'boxer_one_metabox',
'title' => __( 'Boxer Info', 'cmb' ),
'pages' => array( 'boxer' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
// 'cmb_styles' => true, // Enqueue the CMB stylesheet on the frontend
'fields' => array(
array(
'name' => 'Height',
'id' => $prefix . 'height',
'type' => 'text'
),
array(
'name' => 'Weight',
'id' => $prefix . 'weight',
'type' => 'text'
),
array(
'name' => 'Team',
'id' => $prefix . 'team',
'type' => 'text'
),
array(
'name' => 'Position',
'id' => $prefix . 'position',
'type' => 'text'
),
array(
'name' => 'Bio',
'desc' => 'Enter Boxers Bio',
'id' => $prefix . 'bio',
'type' => 'wysiwyg',
'options' => array(),
),
array(
'name' => 'Headshot',
'desc' => 'Upload Boxer Picture',
'id' => $prefix . 'headshot',
'type' => 'file',
'allow' => array( 'attachment' ) // limit to just attachments with array( 'attachment' )
),
),
);
return $meta_boxes;
}
add_action( 'init', 'cmb_initialize_cmb_meta_boxes', 9999 );
/**
* Initialize the metabox class.
*/
function cmb_initialize_cmb_meta_boxes() {
if ( ! class_exists( 'cmb_Meta_Box' ) )
require_once 'Custom-Metaboxes-and-Fields-for-WordPress-master/init.php';
}
// Add Fight Custom Post Type
add_action( 'init', 'register_cpt_fight' );
function register_cpt_fight() {
$labels = array(
'name' => _x( 'fights', 'fight' ),
'singular_name' => _x( 'fight', 'fight' ),
'all_items' => __( 'All Fights', 'fight' ),
'add_new' => _x( 'Add New', 'fight' ),
'add_new_item' => _x( 'Add New Fight', 'fight' ),
'edit_item' => _x( 'Edit fight', 'fight' ),
'new_item' => _x( 'New fight', 'fight' ),
'view_item' => _x( 'View fight', 'fight' ),
'search_items' => _x( 'Search fights', 'fight' ),
'not_found' => _x( 'No fights found', 'fight' ),
'not_found_in_trash' => _x( 'No fights found in Trash', 'fight' ),
'parent_item_colon' => _x( 'Parent fights:', 'fight' ),
'menu_name' => _x( 'Fights', 'fight' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'revisions', 'custom-fields', 'page-attributes' ),
'taxonomies' => array( 'category', 'post_tag', 'page-category'),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'public' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
'capability_type' => 'page'
);
register_post_type( 'fight', $args );
};
add_filter( 'cmb_meta_boxes', 'cmb_fight_metaboxes' );
function cmb_fight_metaboxes( array $meta_boxes ) {
// Start with an underscore to hide fields from custom fields list
$prefix = '_cmb_';
/**
* Sample metabox to demonstrate each field type included
*/
$meta_boxes['fight_metabox'] = array(
'id' => 'fight_metabox',
'title' => __( 'Fight Info', 'cmb' ),
'pages' => array( 'fight' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
// 'cmb_styles' => true, // Enqueue the CMB stylesheet on the frontend
'fields' => array(
array(
'name' => 'Boxer One Name',
'id' => $prefix . 'boxer_one',
'type' => 'text'
),
array(
'name' => 'Boxer Two Name',
'id' => $prefix . 'boxer_two',
'type' => 'text'
),
),
);
return $meta_boxes;
}