-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.php
181 lines (143 loc) · 7.09 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
<?php
function oeru_theme_menu_default() {
if(!get_option("oeru_theme_menu_create")){
require_once("inc/theme_guidance.php");
$menu_id = oeru_theme_create_menu();
if($menu_id == false){
wp_delete_nav_menu("OERu Import Menu");
$menu_id = oeru_theme_create_menu();
}
oeru_theme_menu_hierarchy($menu_id, 0, 0);
$locations = get_theme_mod('nav_menu_locations');
$locations['primary'] = $menu_id;
set_theme_mod('nav_menu_locations', $locations);
add_option("oeru_theme_menu_create", "true");
}
}
add_action( 'admin_head', 'oeru_theme_menu_default' );
function oeru_theme_widgets_init() {
register_sidebar( array(
'name' => __( 'Widget Area', 'oeru_theme' ),
'id' => 'sidebar-1',
'description' => __( 'Add widgets here to appear in your sidebar.', 'oeru_theme' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'oeru_theme_widgets_init' );
function oeru_theme_setup() {
if(!get_option("oeru_course_colour_profile_setup")){
require_once("inc/install_profile.php");
add_option("oeru_course_colour_profile_setup", "true");
}
load_theme_textdomain( 'oeru_theme', get_template_directory() . '/languages' );
add_theme_support( 'post-thumbnails' );
$chargs = array(
'width' => 980,
'height' => 150,
'uploads' => true,
);
add_theme_support( 'custom-header', $chargs );
set_post_thumbnail_size( 672, 372, true );
register_nav_menus( array(
'primary' => __( 'Top primary menu', 'oeru_theme' ),
) );
add_theme_support( 'html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
) );
}
add_action( 'after_setup_theme', 'oeru_theme_setup' );
function oeru_theme_add_category(){
$catarr = array(
'cat_name' => "Front Page Featured",
'category_description' => "Items to feature on the front page",
'category_nicename' => "front-page",
'taxonomy' => 'category'
);
wp_insert_term("Front Page", "category", $catarr);
}
add_action( 'after_setup_theme', 'oeru_theme_add_category' );
function oeru_theme_scripts_and_styles() {
wp_enqueue_style( 'wordpress-oeru-theme-bootstrap', get_template_directory_uri() . '/css/bootstrap.css', array(), '1' );
wp_enqueue_style( 'wordpress-oeru-theme-font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), '1' );
wp_enqueue_style( 'wordpress-oeru-theme-layout', get_template_directory_uri() . '/css/layout.css', array(), '1' );
wp_enqueue_style( 'wordpress-oeru-theme-typography', get_template_directory_uri() . '/css/typography.css', array(), '1' );
wp_enqueue_style( 'wordpress-oeru-theme-colours', get_template_directory_uri() . '/css/colours.css', array(), '1' );
wp_enqueue_style( 'wordpress-oeru-theme-core-alter', get_template_directory_uri() . '/css/oeru_theme_core_alter.css', array(), '1' );
wp_enqueue_style( 'wordpress-oeru-theme-jquery-ui', get_template_directory_uri() . '/css/jquery-ui.min.css', array(), '1' );
wp_enqueue_style( 'wordpress-oeru-theme-open-sans-font', '//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,800,700,600&subset=latin,greek-ext,greek,cyrillic,latin-ext,vietnamese,cyrillic-ext', array(), '1' );
wp_enqueue_script( 'wordpress-oeru_theme-bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '20131205', true );
wp_enqueue_script( 'wordpress-oeru_theme-scroll', get_template_directory_uri() . '/js/wikieducatorjs/scroll.js', array('jquery'), '20131205', true );
if(get_theme_mod("menu_depth")!="two"){
wp_enqueue_script( 'wordpress-oeru_theme-menu-fix', get_template_directory_uri() . '/js/wikieducatorjs/menu-fix.js', array('jquery'), '20131205', true );
}
wp_enqueue_script( 'wordpress-oeru_theme-feedback', get_template_directory_uri() . '/js/wikieducatorjs/oeru_feedback.js', array('jquery'), '20131205', true );
wp_enqueue_script( 'wordpress-oeru_theme-details-fix', get_template_directory_uri() . '/js/wikieducatorjs/oeru_details_fix.js', array('jquery'), '20131205', true );
wp_enqueue_script( 'jquery-ui-accordion');
wp_enqueue_script( 'wordpress-oeru_theme-accordion', get_template_directory_uri() . '/js/wikieducatorjs/oeru_accordion.js', array('jquery-ui-accordion'), '20131205', true );
wp_enqueue_script( 'wordpress-oeru_theme-mcq', get_template_directory_uri() . '/js/wikieducatorjs/oeru_mcq.js', array('jquery'), '20131205', true );
wp_enqueue_script( 'wordpress-oeru_theme-mtq', get_template_directory_uri() . '/js/wikieducatorjs/oeru_mtq.js', array('jquery'), '20131205', true );
wp_enqueue_script( 'wordpress-oeru_theme-fitb_shortcode', get_template_directory_uri() . '/js/wikieducatorjs/oeru_fitb.js', array('jquery'), '20131205', true );
wp_localize_script( 'wordpress-oeru_theme-fitb_shortcode', 'wordpress_oeru_theme_fitb_shortcode', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'answerNonce' => wp_create_nonce( 'oeru_fitb_check' ) ) );
}
add_action( 'wp_enqueue_scripts', 'oeru_theme_scripts_and_styles' );
function oeru_admin_theme_scripts_and_styles() {
wp_enqueue_style( 'wordpress-oeru-theme-admin', get_template_directory_uri() . '/css/oeru_theme_admin.css', array(), '1' );
}
add_action( 'admin_enqueue_scripts', 'oeru_admin_theme_scripts_and_styles' );
// add XMLRPC options
add_filter( 'xmlrpc_blog_options', function( $xmlrpc_options ) {
if (is_array($xmlrpc_options)) {
$xmlrpc_options['show_on_front'] = array(
'desc' => __( 'Show on front' ),
'readonly' => false,
'option' => 'show_on_front'
);
$xmlrpc_options['page_on_front'] = array(
'desc' => __( 'Page to show on front page' ),
'readonly' => false,
'option' => 'page_on_front'
);
$xmlrpc_options['oeru_theme_menu_create'] = array(
'desc' => __( 'Create the OERu top menu' ),
'readonly' => false,
'option' => 'oeru_theme_menu_create'
);
$xmlrpc_options['oeru_theme_scan_page_html'] = array(
'desc' => __( 'HTML for the scan page' ),
'readonly' => false,
'option' => 'oeru_theme_scan_page_html'
);
$xmlrpc_options['oeru_theme_scan_page'] = array(
'desc' => __( 'Turn the Scan Page on' ),
'readonly' => false,
'option' => 'oeru_theme_scan_page'
);
$xmlrpc_options['oeru_theme_footer'] = array(
'desc' => __( 'Footer content' ),
'readonly' => false,
'option' => 'oeru_theme_footer'
);
}
return $xmlrpc_options;
});
// Custom template tags for this theme.
require get_template_directory() . '/inc/template-tags.php';
// Add Customizer functionality.
require get_template_directory() . '/inc/customizer.php';
// Add shortcodes.
require get_template_directory() . '/inc/shortcode.php';
// Add image attribution.
require get_template_directory() . '/inc/image_attribution.php';
// Add theme guidance.
require get_template_directory() . '/inc/theme_guidance.php';
//Add basic menu
require_once("inc/Walker_OERU_Menu.php");
//Add reduced menu
require_once("inc/Walker_OERU_Menu_Depth.php");
//Add scan page menu
require_once("inc/scanpage_settings.php");
//Add colour choice options
require_once("inc/colour_scheme.php");