-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplugin.php
More file actions
79 lines (67 loc) · 2.31 KB
/
plugin.php
File metadata and controls
79 lines (67 loc) · 2.31 KB
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
<?php declare(strict_types=1);
/**
* Plugin Name: UCSC Custom Functionality
* Plugin URI: https://github.com/ucsc/ucsc-custom-functionality.git
* Description: Adds custom functionality to UCSC WordPress Websites.
* Version: 1.9.5
* Author: UC Santa Cruz
* Author URI: https://github.com/ucsc
* License: GPL2
*
* @package ucsc-custom-functionality
*/
// Set plugin directory.
define( 'UCSC_DIR', dirname( __FILE__ ) );
define( 'UCSC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
// Include Customization files.
if ( file_exists( UCSC_DIR . '/vendor/autoload.php' ) ) {
include_once UCSC_DIR . '/vendor/autoload.php';
}
// Shortcodes.
if ( file_exists( UCSC_DIR . '/lib/functions/shortcodes.php' ) ) {
include_once UCSC_DIR . '/lib/functions/shortcodes.php';
}
// Admin options.
if ( file_exists( UCSC_DIR . '/lib/functions/admin-menus.php' ) ) {
include_once UCSC_DIR . '/lib/functions/admin-menus.php';
}
// Scripts.
if ( file_exists( UCSC_DIR . '/lib/functions/scripts.php' ) ) {
include_once UCSC_DIR . '/lib/functions/scripts.php';
}
// Settings.
if ( file_exists( UCSC_DIR . '/lib/functions/settings.php' ) ) {
include_once UCSC_DIR . '/lib/functions/settings.php';
}
if ( ! function_exists( 'ucsc_enqueue_admin_styles' ) ) {
/**
* Enqueue admin settings styles
*
* No styles are enqueued for raw HTML in setting panel.
* In order to output HTML in the settings panel we need some basic styles.
*
* @since 1.7.0
*
* @author UCSC
*
* @link https://developer.wordpress.org/reference/hooks/admin_enqueue_scripts/#Example:_Load_CSS_File_from_a_plugin_on_specific_Admin_Page
*/
function ucsc_enqueue_admin_styles($hook): void {
$settings_css = plugin_dir_url( __FILE__ ) . 'lib/css/admin-settings.css';
$current_screen = get_current_screen();
// Check if it's "?page=ucsc-custom-functionality-settings." If not, just empty return.
if ( strpos( $current_screen->base, 'ucsc-custom-functionality-settings' ) === false ) {
return;
}
// Load css.
wp_register_style( 'ucsc-cf-admin-settings', $settings_css, );
wp_enqueue_style( 'ucsc-cf-admin-settings' );
}
}
add_action( 'admin_enqueue_scripts', 'ucsc_enqueue_admin_styles' );
add_action( 'plugins_loaded', static function (): void {
if ( ! function_exists( 'acf_add_local_field_group' ) ) {
return;
}
\UCSC\Blocks\Core::instance()->init();
}, 100, 0 );