| 1 |
<?php |
| 2 |
/** |
| 3 |
* Scripts |
| 4 |
* |
| 5 |
* @package GamiPress\PeepSo\Scripts |
| 6 |
* @since 1.0.0 |
| 7 |
*/ |
| 8 |
// Exit if accessed directly |
| 9 |
if( !defined( 'ABSPATH' ) ) exit; |
| 10 |
|
| 11 |
/** |
| 12 |
* Register admin scripts |
| 13 |
* |
| 14 |
* @since 1.0.0 |
| 15 |
* @return void |
| 16 |
*/ |
| 17 |
function gamipress_peepso_admin_register_scripts() { |
| 18 |
|
| 19 |
// Use minified libraries if SCRIPT_DEBUG is turned off |
| 20 |
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 21 |
|
| 22 |
// Stylesheets |
| 23 |
wp_register_style( 'gamipress-peepso-admin-css', GAMIPRESS_PEEPSO_URL . 'assets/css/gamipress-peepso-admin' . $suffix . '.css', array( ), GAMIPRESS_PEEPSO_VER, 'all' ); |
| 24 |
|
| 25 |
// Scripts |
| 26 |
wp_register_script( 'gamipress-peepso-admin-js', GAMIPRESS_PEEPSO_URL . 'assets/js/gamipress-peepso-admin' . $suffix . '.js', array( 'jquery', 'jquery-ui-sortable' ), GAMIPRESS_PEEPSO_VER, true ); |
| 27 |
|
| 28 |
} |
| 29 |
add_action( 'admin_init', 'gamipress_peepso_admin_register_scripts' ); |
| 30 |
|
| 31 |
/** |
| 32 |
* Enqueue admin scripts |
| 33 |
* |
| 34 |
* @since 1.0.0 |
| 35 |
* @return void |
| 36 |
*/ |
| 37 |
function gamipress_peepso_admin_enqueue_scripts( $hook ) { |
| 38 |
|
| 39 |
// Settings page |
| 40 |
if( $hook === 'gamipress_page_gamipress_settings' ) { |
| 41 |
|
| 42 |
//Stylesheets |
| 43 |
wp_enqueue_style( 'gamipress-peepso-admin-css' ); |
| 44 |
|
| 45 |
//Scripts |
| 46 |
wp_enqueue_script( 'gamipress-peepso-admin-js' ); |
| 47 |
|
| 48 |
} |
| 49 |
|
| 50 |
} |
| 51 |
add_action( 'admin_enqueue_scripts', 'gamipress_peepso_admin_enqueue_scripts', 100 ); |