-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
182 lines (147 loc) · 5.31 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
<?php
function addCustomThemeStyles() {
wp_enqueue_style('fontawesome', 'https://use.fontawesome.com/releases/v5.4.2/css/all.css', array(), '5.4.2', 'all');
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css', array(), '4.1.3', 'all');
wp_enqueue_style('customcss', get_template_directory_uri() . '/assets/css/theme-style.css', array(), '0.0.1', 'all');
wp_enqueue_script('jquery');
wp_enqueue_script('bootstrapjs', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array(), '4.1.3', true);
wp_enqueue_script('customjs', get_template_directory_uri(). '/assets/js/theme-script.js', array(), '0.0.1', true);
}
add_action('wp_enqueue_scripts', 'addCustomThemeStyles');
add_theme_support('post-thumbnails');
function addCustomMenus(){
add_theme_support('menus');
register_nav_menu('main_nav', 'In the middle of the homepage');
}
// Fire the function/add action on initilising the theme
add_action('init', 'addCustomMenus');
add_image_size('icon', 50, 50, true);
//-------------- ADDING POST TYPE STUDENTS -----------------
// WEB STUDENTS
function add_webStudents_post_type(){
$labels = array(
'name' => _x('Web and UX', 'post type name', 'infusetheme'),
'singular_name' => _x('Web and UX', 'post type singular name', 'infusetheme'),
'add_new_item' => _x('Add web student', 'adding web student', 'infusetheme')
);
$args = array(
'labels' => $labels,
'description' => 'a post type for the web students',
'public' => true,
'hierarchical' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => false,
'menu_position' => 5,
'menu_icon' => 'dashicons-laptop',
'supports' => array(
'title',
'editor',
'thumbnail'
),
'query_var' => true
);
register_post_type('webStudents', $args);
}
add_action('init', 'add_webStudents_post_type');
// Creative digital STUDENTS
function add_graphicsStudents_post_type(){
$labels = array(
'name' => _x('Creative Digital', 'post type name', 'infusetheme'),
'singular_name' => _x('Creative Digital', 'post type singular name', 'infusetheme'),
'add_new_item' => _x('Add graphics student', 'adding graphics student', 'infusetheme')
);
$args = array(
'labels' => $labels,
'description' => 'a post type for the graphics students',
'public' => true,
'hierarchical' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => false,
'menu_position' => 6,
'menu_icon' => 'dashicons-art',
'supports' => array(
'title',
'editor',
'thumbnail'
),
'query_var' => true
);
register_post_type('graphicsStudents', $args);
}
add_action('init', 'add_graphicsStudents_post_type');
// Screen production STUDENTS
function add_screenStudents_post_type(){
$labels = array(
'name' => _x('Screen Production', 'post type name', 'infusetheme'),
'singular_name' => _x('Screen Production', 'post type singular name', 'infusetheme'),
'add_new_item' => _x('Add screen student', 'adding screen student', 'infusetheme')
);
$args = array(
'labels' => $labels,
'description' => 'a post type for the screen students',
'public' => true,
'hierarchical' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => false,
'menu_position' => 7,
'menu_icon' => 'dashicons-editor-video',
'supports' => array(
'title',
'editor',
'thumbnail'
),
'query_var' => true
);
register_post_type('screenStudents', $args);
}
add_action('init', 'add_screenStudents_post_type');
//-------------- ADDING LOGO SUPPORT -----------------
function addCustomLogo() {
add_theme_support('custom-logo', array(
'height' => 480,
'width' => 350,
'flex-height' => true,
'flex-width' => true
));
}
add_action('init', 'addCustomLogo');
//-------------- REGISTERING A WIDGET SECTION -----------------
function register_event_details_widget() {
register_sidebar(array(
'id' => 'front_date_widget',
'name' => 'Date widget',
'description' => 'Date and time for event which appears on the main page',
'before_widget' => '<div id="%1$s" class="date-widget exhib-address %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="exhib-time">',
'after_title' => '</h3><hr class="hr">'
));
}
add_action('widgets_init', 'register_event_details_widget');
// Disabling certain widgets
function remove_the_widget() {
unregister_widget('WP_Widget_Calendar');
unregister_widget('WP_Widget_Archives');
unregister_widget('WP_Widget_Media_Audio');
unregister_widget('WP_Widget_Media_Image');
unregister_widget('WP_Widget_Media_Video');
unregister_widget('WP_Widget_Meta');
unregister_widget('WP_Widget_Search');
unregister_widget('WP_Widget_Categories');
unregister_widget('WP_Widget_Recent_Posts');
unregister_widget('WP_Widget_Recent_Comments');
unregister_widget('WP_Widget_Tag_Cloud');
unregister_widget('WP_Nav_Menu_Widget');
unregister_widget('WP_Widget_Custom_HTML');
unregister_widget('WP_Widget_RSS');
unregister_widget('WP_Widget_Pages');
unregister_widget('WP_Widget_Gallery');
}
add_action( 'widgets_init', 'remove_the_widget' );
require get_parent_theme_file_path('./addons/custom_customizer.php');
// RESTRICT IMAGE CROP
add_image_size('project-thumbnail', 324, 211, true);
require get_parent_theme_file_path('./addons/custom_fields.php');