forked from jonmbennett/betheme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
193 lines (149 loc) · 6.29 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
183
184
185
186
187
188
189
190
191
192
193
<?php
/**
* Theme Functions
*
* @package Betheme
* @author Muffin group
* @link http://muffingroup.com
*/
define( 'THEME_DIR', get_template_directory() );
define( 'THEME_URI', get_template_directory_uri() );
define( 'THEME_NAME', 'betheme' );
define( 'THEME_VERSION', '20.4.4' );
define( 'LIBS_DIR', THEME_DIR. '/functions' );
define( 'LIBS_URI', THEME_URI. '/functions' );
define( 'LANG_DIR', THEME_DIR. '/languages' );
add_filter( 'widget_text', 'do_shortcode' );
add_filter( 'the_excerpt', 'shortcode_unautop' );
add_filter( 'the_excerpt', 'do_shortcode' );
/* ----------------------------------------------------------------------------
* White Label
* IMPORTANT: We recommend the use of Child Theme to change this
* ---------------------------------------------------------------------------- */
defined( 'WHITE_LABEL' ) or define( 'WHITE_LABEL', false );
/* ----------------------------------------------------------------------------
* Loads Theme Textdomain
* ---------------------------------------------------------------------------- */
load_theme_textdomain( 'betheme', LANG_DIR ); // frontend
load_theme_textdomain( 'mfn-opts', LANG_DIR ); // backend
/* ----------------------------------------------------------------------------
* Loads the Options Panel
* ---------------------------------------------------------------------------- */
if( ! function_exists( 'mfn_admin_scripts' ) )
{
function mfn_admin_scripts() {
wp_enqueue_script( 'jquery-ui-sortable' );
}
}
add_action( 'wp_enqueue_scripts', 'mfn_admin_scripts' );
add_action( 'admin_enqueue_scripts', 'mfn_admin_scripts' );
require( THEME_DIR .'/muffin-options/theme-options.php' );
/* ----------------------------------------------------------------------------
* Loads Theme Functions
* ---------------------------------------------------------------------------- */
$theme_disable = mfn_opts_get( 'theme-disable' );
// Functions ------------------------------------------------------------------
require_once( LIBS_DIR .'/theme-functions.php' );
// Header ---------------------------------------------------------------------
require_once( LIBS_DIR .'/theme-head.php' );
// Menu -----------------------------------------------------------------------
require_once( LIBS_DIR .'/theme-menu.php' );
if( ! isset( $theme_disable['mega-menu'] ) ){
require_once( LIBS_DIR .'/theme-mega-menu.php' );
}
// Muffin Builder -------------------------------------------------------------
require_once( LIBS_DIR .'/builder/fields.php' );
require_once( LIBS_DIR .'/builder/back.php' );
require_once( LIBS_DIR .'/builder/front.php' );
// Custom post types ----------------------------------------------------------
$post_types_disable = mfn_opts_get( 'post-type-disable' );
if( ! isset( $post_types_disable['client'] ) ){
require_once( LIBS_DIR .'/meta-client.php' );
}
if( ! isset( $post_types_disable['offer'] ) ){
require_once( LIBS_DIR .'/meta-offer.php' );
}
if( ! isset( $post_types_disable['portfolio'] ) ){
require_once( LIBS_DIR .'/meta-portfolio.php' );
}
if( ! isset( $post_types_disable['slide'] ) ){
require_once( LIBS_DIR .'/meta-slide.php' );
}
if( ! isset( $post_types_disable['testimonial'] ) ){
require_once( LIBS_DIR .'/meta-testimonial.php' );
}
if( ! isset( $post_types_disable['layout'] ) ){
require_once( LIBS_DIR .'/meta-layout.php' );
}
if( ! isset( $post_types_disable['template'] ) ){
require_once( LIBS_DIR .'/meta-template.php' );
}
require_once( LIBS_DIR .'/meta-page.php' );
require_once( LIBS_DIR .'/meta-post.php' );
// Content --------------------------------------------------------------------
require_once( THEME_DIR .'/includes/content-post.php' );
require_once( THEME_DIR .'/includes/content-portfolio.php' );
// Shortcodes -----------------------------------------------------------------
require_once( LIBS_DIR .'/theme-shortcodes.php' );
// Hooks ----------------------------------------------------------------------
require_once( LIBS_DIR .'/theme-hooks.php' );
// Widgets --------------------------------------------------------------------
require_once( LIBS_DIR .'/widget-functions.php' );
require_once( LIBS_DIR .'/widget-flickr.php' );
require_once( LIBS_DIR .'/widget-login.php' );
require_once( LIBS_DIR .'/widget-menu.php' );
require_once( LIBS_DIR .'/widget-recent-comments.php' );
require_once( LIBS_DIR .'/widget-recent-posts.php' );
require_once( LIBS_DIR .'/widget-tag-cloud.php' );
// TinyMCE --------------------------------------------------------------------
require_once( LIBS_DIR .'/tinymce/tinymce.php' );
// Plugins --------------------------------------------------------------------
require_once( LIBS_DIR .'/class-love.php' );
require_once( LIBS_DIR .'/plugins/visual-composer.php' );
// WooCommerce specified functions
if( function_exists( 'is_woocommerce' ) ){
require_once( LIBS_DIR .'/theme-woocommerce.php' );
}
// Disable responsive images in WP 4.4+ if Retina.js enabled
if( mfn_opts_get( 'retina-js' ) ){
add_filter( 'wp_calculate_image_srcset', '__return_false' );
}
// Hide activation and update specific parts ----------------------------------
// Slider Revolution
if( ! mfn_opts_get( 'plugin-rev' ) ){
if( function_exists( 'set_revslider_as_theme' ) ){
set_revslider_as_theme();
}
}
// LayerSlider
if( ! mfn_opts_get( 'plugin-layer' ) ){
add_action( 'layerslider_ready', 'mfn_layerslider_overrides' );
function mfn_layerslider_overrides() {
// Disable auto-updates
$GLOBALS['lsAutoUpdateBox'] = false;
}
}
// Visual Composer
if( ! mfn_opts_get( 'plugin-visual' ) ){
add_action( 'vc_before_init', 'mfn_vcSetAsTheme' );
function mfn_vcSetAsTheme() {
vc_set_as_theme();
}
}
// Dashboard ------------------------------------------------------------------
if( is_admin() ){
require_once LIBS_DIR .'/admin/class-mfn-api.php';
require_once LIBS_DIR .'/admin/class-mfn-helper.php';
require_once LIBS_DIR .'/admin/class-mfn-update.php';
require_once LIBS_DIR .'/admin/class-mfn-dashboard.php';
$mfn_dashboard = new Mfn_Dashboard();
if( ! isset( $theme_disable['demo-data'] ) ){
require_once LIBS_DIR .'/importer/class-mfn-importer.php';
}
require_once LIBS_DIR .'/admin/tgm/class-mfn-tgmpa.php';
if( ! mfn_is_hosted() ){
require_once LIBS_DIR .'/admin/class-mfn-status.php';
}
require_once LIBS_DIR .'/admin/class-mfn-support.php';
require_once LIBS_DIR .'/admin/class-mfn-changelog.php';
}