-
Notifications
You must be signed in to change notification settings - Fork 123
/
functions.php
executable file
·78 lines (52 loc) · 1.58 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
<?php
//require 'inc/custom-routes.php';
require 'inc/custom-routes.php';
require 'inc/angular-enqueue.php';
class angularjs_wp_theme {
function init() {
add_action( 'init', array( $this, 'register_my_menus' ) );
add_action( 'init', array( $this, 'register_my_sidebar' ) );
add_action( 'after_setup_theme', array( $this, 'add_awesome_theme_support' ) );
add_action( 'admin_init', array( $this, 'apiCheck' ) );
$angularScripts = new angular_enqueue();
$angularScripts->init();
$ang_routes = new angular_theme_routes();
$ang_routes->__init();
}
function apiCheck(){
if ( !class_exists( 'WP_REST_Response' ) ) {
add_action( 'admin_notices', array( $this, 'apiError' ) );
}
}
function apiError(){
echo '<div class="error"><p><strong>JSON REST API</strong> must be installed and activated for this theme to work properly</p></div>';
}
/* THEME SUPPORT */
function add_awesome_theme_support(){
add_theme_support( 'post-thumbnails' );
add_post_type_support( 'page', 'excerpt' );
}
// REGISTER MENUS
function register_my_menus() {
register_nav_menus(
array(
'header-menu' => __( 'Header Menu' ),
'footer-menu' => __( 'Footer Menu' )
)
);
}
//REGISTER SIDEBAR
function register_my_sidebar() {
register_sidebar(array(
'name' => 'Right Side',
'id' => 'right-sidebar',
'before_widget' => '<section>',
'after_widget' => '</section>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
}
}
$angularJStheme = new angularjs_wp_theme();
$angularJStheme->init();
?>