-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.php
107 lines (88 loc) · 2.88 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
<?php
/**
* Register navigation menu in header.
*/
function register_my_menu() {
register_nav_menu('header-menu',__( 'Header Menu' ));
register_nav_menu('portals',__( 'Portals' ));
}
add_action( 'init', 'register_my_menu' );
global $hths_widget_wrapper_args;
/**
* Global defaults for the fancybox widget wrapper markup.
*/
$hths_widget_wrapper_args = array(
'before_widget' => '<div class="fancybox">',
'after_widget' => '</div>',
'before_title' => '<h2 class="fancytitle">',
'after_title' => '</h2>'
);
/**
* Register sidebars, widgetized areas, and custom widgets.
*/
function hths_widgets_init() {
global $hths_widget_wrapper_args;
require('widgets/HTHS_Calendar_Widget.php');
register_widget('HTHS_Calendar_Widget');
require('widgets/HTHS_Weather_Widget.php');
register_widget('HTHS_Weather_Widget');
require('widgets/HTHS_Social_Feed_Widget.php');
register_widget('HTHS_Social_Feed_Widget');
require('widgets/HTHS_Stay_Connected_Widget.php');
register_widget('HTHS_Stay_Connected_Widget');
require('widgets/HTHS_Recent_News_Widget.php');
register_widget('HTHS_Recent_News_Widget');
require('widgets/HTHS_One_Call_Now_Widget.php');
register_widget('HTHS_One_Call_Now_Widget');
register_sidebar(wp_parse_args(array(
'name' => 'Main Right Sidebar',
'id' => 'main_sidebar'
), $hths_widget_wrapper_args));
register_sidebar(wp_parse_args(array(
'name' => 'Homepage Left Column',
'id' => 'home_left'
), $hths_widget_wrapper_args));
register_sidebar(wp_parse_args(array(
'name' => 'Homepage Right Column',
'id' => 'home_right'
), $hths_widget_wrapper_args));
}
add_action( 'widgets_init', 'hths_widgets_init' );
/**
* Include the TGM_Plugin_Activation class.
*/
require_once get_stylesheet_directory() . '/lib/class-tgm-plugin-activation.php';
add_action( 'tgmpa_register', 'my_theme_register_required_plugins' );
function my_theme_register_required_plugins() {
$plugins = array(
array(
'name' => 'WP-Filebase Download Manager',
'slug' => 'wp-filebase',
'required' => true,
),
array(
'name' => 'GitHub Updater',
'slug' => 'github-updater',
'source' => 'github-updater-2.4.5.zip',
'required' => false,
'version' => '2.4.5',
),
array(
'name' => 'User Photo',
'slug' => 'user-photo',
'required' => true,
),
);
$config = array(
'default_path' => get_stylesheet_directory() . '/lib/',
);
tgmpa( $plugins, $config );
}
// Teacher user role
// TODO: refactor into separate plugin from theme
function add_teacher_user_role() {
add_role('hths_teacher', __('HTHS Teacher'), array(
'read' => true
));
}
add_action('after_setup_theme', 'add_teacher_user_role');