-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
54 lines (46 loc) · 1.38 KB
/
index.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
<?php
/**
* Load include
*/
foreach ( glob( __DIR__ . "/includes/*.php" ) as $filename ) {
include $filename;
}
/**
* Load post types
*/
add_action( 'after_setup_theme', function () {
if ( defined( 'CUSTOM_CPT_DEVELOPMENT_MODE' ) && CUSTOM_CPT_DEVELOPMENT_MODE !== true ) {
foreach ( glob( __DIR__ . "/post-types/*.php" ) as $filename ) {
include $filename;
}
}
} );
/**
* Load fields
*/
add_action( 'after_setup_theme', function () {
if ( defined( 'CUSTOM_CPT_DEVELOPMENT_MODE' ) && CUSTOM_CPT_DEVELOPMENT_MODE !== true ) {
foreach ( glob( __DIR__ . "/fields/*.php" ) as $filename ) {
include $filename;
}
}
} );
/**
* Load shortcodes
*/
add_action( 'after_setup_theme', function () {
foreach ( glob( __DIR__ . "/shortcodes/*" ) as $sc_dir ) {
include $sc_dir . '/shortcode.php';
add_shortcode( basename($sc_dir), array( basename($sc_dir), 'display' ) );
}
} );
/** Visual Composer mappings **/
add_action( 'init', function () {
global $pagenow;
//Only load in admin mode on posts page. Will probably screw up frontend editor.
if ( function_exists( 'vc_map' ) && is_admin() && $pagenow === 'post.php' || $pagenow === 'admin-ajax.php' || $pagenow === 'post-new.php' ) {
foreach ( glob( __DIR__ . "/shortcodes/*" ) as $sc_dir ) {
include $sc_dir . '/vc_map.php';
}
}
}, 9 ); //Show our custom shortcodes first in the list