-
Notifications
You must be signed in to change notification settings - Fork 2
/
functions.php
139 lines (124 loc) · 4.87 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
<?php
/**
* Setup the theme and load modules.
*/
add_action( 'after_setup_theme', 'showcase_setup' );
function showcase_setup() {
// Include generic functions
require_once __DIR__ . '/lib/plugin-check.php';
require_once __DIR__ . '/lib/fallback-menu.php';
require_once __DIR__ . '/lib/theme-init.php';
require_once __DIR__ . '/lib/template-helpers.php';
require_once __DIR__ . '/lib/demo-data.php';
// Include the module loader and initialize it
require_once __DIR__ . '/modules/class-module-loader.php';
Module_Loader::get_instance();
}
/**
* Loads all built-in modules.
*
* @param Module_Loader $loader A loader that includes modules.
*/
add_action( 'showcase.load_modules', 'showcase_builtin_modules' );
function showcase_builtin_modules( $loader ) {
$loader->add_module( 'quote', array(
'title' => __( 'Quote Shortcode', 'showcase' ),
'pro' => true,
'path' => __DIR__ . '/modules/quote',
'url' => get_template_directory_uri() . '/modules/quote',
'redirect' => admin_url( 'post.php?post=1&action=edit' )
));
$loader->add_module( 'events', array(
'title' => __( 'Events', 'showcase' ),
'pro' => true,
'path' => __DIR__ . '/modules/events',
'url' => get_template_directory_uri() . '/modules/events',
'redirect' => home_url( '/' ), // @todo: Add a proper URL
));
$loader->add_module( 'menu', array(
'title' => __( 'Mega Menu', 'showcase' ),
'pro' => true,
'path' => __DIR__ . '/modules/menu',
'url' => get_template_directory_uri() . '/modules/menu',
'redirect' => 'showcase_create_main_menu'
));
$loader->add_module( 'content-blocks', array(
'title' => __( 'Content Blocks', 'showcase' ),
'pro' => true,
'path' => __DIR__ . '/modules/content-blocks',
'url' => get_template_directory_uri() . '/modules/content-blocks',
'redirect' => function() {
return admin_url( 'post.php?post=2&action=edit' );
}
));
$loader->add_module( 'colors', array(
'title' => __( 'Colors', 'showcase' ),
'pro' => true,
'path' => __DIR__ . '/modules/colors',
'url' => get_template_directory_uri() . '/modules/colors',
'redirect' => home_url( 'wp-admin/customize.php?autofocus[section]=uf_section_theme_colors' ), // @todo: Add a proper URL
));
$loader->add_module( 'accordion-widget', array(
'title' => __( 'Accordion Widget', 'showcase' ),
'pro' => true,
'path' => __DIR__ . '/modules/accordion-widget',
'url' => get_template_directory_uri() . '/modules/accordion-widget',
'redirect' => home_url( 'wp-admin/widgets.php' )
));
$loader->add_module( 'related-posts', array(
'title' => __( 'Related Posts', 'showcase' ),
'pro' => false,
'path' => __DIR__ . '/modules/related-posts',
'url' => get_template_directory_uri() . '/modules/related-posts',
'redirect' => admin_url( 'post.php?post=1&action=edit' )
));
$loader->add_module( 'team', array(
'title' => __( 'Team', 'showcase' ),
'pro' => false,
'path' => __DIR__ . '/modules/team',
'url' => get_template_directory_uri() . '/modules/team',
'redirect' => admin_url( 'post.php?post=2&action=edit' )
));
$loader->add_module( 'site-layout', array(
'title' => __( 'Site Layout', 'showcase' ),
'pro' => true,
'path' => __DIR__ . '/modules/site-layout',
'url' => get_template_directory_uri() . '/modules/site-layout',
'redirect' => admin_url( 'themes.php?page=theme-options' )
));
$loader->add_module( 'enhanced-categories', array(
'title' => __( 'Enhanced categories', 'showcase' ),
'pro' => true,
'path' => __DIR__ . '/modules/enhanced-categories',
'url' => get_template_directory_uri() . '/modules/enhanced-categories',
'redirect' => admin_url( 'term.php?taxonomy=category&tag_ID=1' )
));
$loader->add_module( 'photographers', array(
'title' => __( 'Photographers', 'showcase' ),
'pro' => true,
'path' => __DIR__ . '/modules/photographers',
'url' => get_template_directory_uri() . '/modules/photographers',
'redirect' => admin_url( 'media.php' )
));
$loader->add_module( 'fonts', array(
'title' => __( 'Fonts', 'showcase' ),
'pro' => true,
'path' => __DIR__ . '/modules/fonts',
'url' => get_template_directory_uri() . '/modules/fonts',
'redirect' => admin_url( 'themes.php?page=theme-options' )
));
$loader->add_module( 'downloads', array(
'title' => __( 'Downloads', 'showcase' ),
'pro' => false,
'path' => __DIR__ . '/modules/downloads',
'url' => get_template_directory_uri() . '/modules/downloads',
'redirect' => admin_url( 'post.php?post=1&action=edit' )
));
$loader->add_module( 'comment-tags', array(
'title' => __( 'Comment Tags', 'showcase' ),
'pro' => true,
'path' => __DIR__ . '/modules/comment-tags',
'url' => get_template_directory_uri() . '/modules/comment-tags',
'redirect' => admin_url( 'comment.php?action=editcomment&c=1' )
));
}