HEX
Server: Apache
System: Linux p3plzcpnl489499.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: dwauav0tm6jp (6177017)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/dwauav0tm6jp/hosted/justinpods_com/wp-content/themes/megaphone/core/admin/enqueue.php
<?php

/* Load admin scripts and styles */
add_action( 'admin_enqueue_scripts', 'megaphone_load_admin_scripts' );


/**
 * Load scripts and styles in admin
 *
 * It just wrapps two other separate functions for loading css and js files in admin
 *
 * @since  1.0
 */

function megaphone_load_admin_scripts() {
	megaphone_load_admin_css();
	megaphone_load_admin_js();
}


/**
 * Load admin css files
 *
 * @since  1.0
 */

function megaphone_load_admin_css() {

	global $pagenow, $typenow;

	//Load minor admin style tweaks
	wp_enqueue_style( 'megaphone-global', get_parent_theme_file_uri( '/assets/css/admin/global.css' ), false, MEGAPHONE_THEME_VERSION );
}


/**
 * Load admin js files
 *
 * @since  1.0
 */

function megaphone_load_admin_js() {

	global $pagenow, $typenow;

	//Load global js
	wp_enqueue_script( 'megaphone-global', get_parent_theme_file_uri( '/assets/js/admin/global.js' ) , array( 'jquery' ), MEGAPHONE_THEME_VERSION );

	//Load category JS
	if ( in_array( $pagenow, array( 'edit-tags.php', 'term.php' ) ) && isset( $_GET['taxonomy'] ) && ( $_GET['taxonomy'] == 'category' || $_GET['taxonomy'] == 'series' ) ) {
	 wp_enqueue_media();
	 wp_enqueue_script( 'megaphone-category', get_parent_theme_file_uri( '/assets/js/admin/metaboxes-category.js' ), array( 'jquery' ), MEGAPHONE_THEME_VERSION );
	}

	//Load post & page js
	if ( $typenow == 'page' && in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) {
	  wp_enqueue_script( 'megaphone-page', get_parent_theme_file_uri( '/assets/js/admin/metaboxes-page.js' ), array( 'jquery' ), MEGAPHONE_THEME_VERSION );
	  wp_localize_script( 'megaphone-page', 'megaphone_js_settings', megaphone_get_admin_js_settings() );
	}


}

/**
 * Load editor styles
 *
 * @since  1.0
 */

function megaphone_load_editor_styles() {

	if ( $fonts_link = megaphone_generate_fonts_link() ) {
		add_editor_style( $fonts_link );
	}

	add_editor_style( get_parent_theme_file_uri( '/assets/css/admin/editor-style.css' ) );

}

/**
 * Load dynamic editor styles
 *
 * @since  1.0
 */

add_action( 'enqueue_block_editor_assets', 'megaphone_block_editor_styles', 99 );

function megaphone_block_editor_styles() {

	wp_register_style( 'megaphone-editor-styles', false, MEGAPHONE_THEME_VERSION );
	wp_enqueue_style( 'megaphone-editor-styles');

	wp_add_inline_style( 'megaphone-editor-styles', megaphone_generate_dynamic_editor_css() );
}