generated from uriweb/uri-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uri-careers.php
66 lines (54 loc) · 1.89 KB
/
uri-careers.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
<?php
/**
* Plugin Name: URI Careers
* Plugin URI: http://www.uri.edu
* Description: A plugin to display Major and Career data
* Version: 1.0.6
* Author: URI Web Communications
* Author URI: https://today.uri.edu/
*
* @author: Brandon Fuller <[email protected]>
* @author: Alexandra Gauss <[email protected]>
* @author: Sarah Pucino <[email protected]>
* @package uri-careers
*/
// Block direct requests
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
define( 'URI_CAREERS_PATH', plugin_dir_path( __FILE__ ) );
/**
* Returns version from package.json to be used for cache busting
*
* @return str
*/
function uri_careers_cache_buster() {
static $cache_buster;
if ( empty( $cache_buster ) && function_exists( 'get_plugin_data' ) ) {
$values = get_plugin_data( URI_CAREERS_PATH . 'uri-careers.php', false );
$cache_buster = $values['Version'];
} else {
$cache_buster = gmdate( 'Ymd', strtotime( 'now' ) );
}
return $cache_buster;
}
/**
* Include css and js
*/
function uri_careers_enqueues() {
wp_register_style( 'uri-careers-css', plugins_url( '/css/style.built.css', __FILE__ ), array(), uri_cl_cache_buster(), 'all' );
wp_enqueue_style( 'uri-careers-css' );
wp_register_script( 'uri-careers-js', plugins_url( '/js/script.built.js', __FILE__ ), array(), uri_cl_cache_buster(), true );
wp_enqueue_script( 'uri-careers-js' );
}
add_action( 'wp_enqueue_scripts', 'uri_careers_enqueues' );
// require the individual field definitions from a different file
require_once dirname( __FILE__ ) . '/inc/uri-careers-fields.php';
// require the templating functions
require_once dirname( __FILE__ ) . '/inc/uri-careers-templating.php';
// require the helper functions
require_once dirname( __FILE__ ) . '/inc/uri-careers-helpers.php';
// include shortcode
include( URI_CAREERS_PATH . 'inc/uri-careers-shortcode.php' );
// include toggle
include( URI_CAREERS_PATH . 'templates/toggle.php' );