-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore-init.php
66 lines (59 loc) · 2.05 KB
/
core-init.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
<?php
/*
============= Gad Lab Meteo =============
This file initializes all core components
*/
// If this file is called directly, abort. //
if ( ! defined( 'WPINC' ) ) {die;} // end if
// Define Our Constants
define('GLM_CORE_INC',dirname( __FILE__ ).'/assets/inc/');
define('GLM_CORE_ADMIN',dirname( __FILE__ ).'/assets/admin/');
define('GLM_CORE_IMG',plugins_url( 'assets/img/', __FILE__ ));
define('GLM_CORE_CSS',plugins_url( 'assets/css/', __FILE__ ));
define('GLM_CORE_JS',plugins_url( 'assets/js/', __FILE__ ));
define('GLM_CORE_LANG',dirname( __FILE__ ).'/languages/');
/* -----------------
Register CSS file
-----------------
*/
function glm_register_core_css(){
wp_enqueue_style('glm-core', GLM_CORE_CSS . 'glm-core.css',null,time(),'all');
};
add_action( 'wp_enqueue_scripts', 'glm_register_core_css' );
/* ------------------------
Register JS/Jquery Ready
------------------------
*/
function glm_register_core_js(){
// Register Core Plugin JS
wp_enqueue_script('glm-core', GLM_CORE_JS . 'glm-core.js','jquery',time(),true);
};
add_action( 'wp_enqueue_scripts', 'glm_register_core_js' );
/* ----------------------------
Includes all necessary files
----------------------------
*/
// Load the Functions
if ( file_exists( GLM_CORE_INC . 'glm-core-functions.php' ) ) {
require_once GLM_CORE_INC . 'glm-core-functions.php';
}
// Load the ajax Request
if ( file_exists( GLM_CORE_INC . 'glm-ajax-request.php' ) ) {
require_once GLM_CORE_INC . 'glm-ajax-request.php';
}
// Load the Shortcodes
if ( file_exists( GLM_CORE_INC . 'glm-shortcodes.php' ) ) {
require_once GLM_CORE_INC . 'glm-shortcodes.php';
}
// Load the Admin page
if ( file_exists( GLM_CORE_ADMIN . 'glm-admin.php' ) ) {
require_once GLM_CORE_ADMIN . 'glm-admin.php';
}
/* ---------------------------------------
Load plugin textdomain for localization
---------------------------------------
*/
function glm_load_textdomain() {
load_plugin_textdomain( 'glm', false, basename( dirname( __FILE__ ) ) . '/languages/' );
}
add_action( 'init', 'glm_load_textdomain' );