Astra_Ext_Sticky_Header_Markup::admin_enqueue_scripts( String $hook )

Enqueue Admin Scripts Callback


Description


Parameters

$hook

(String) (Required) Screen name where the hook is fired.


Source

File: addons/sticky-header/classes/class-astra-ext-sticky-header-markup.php

		public function admin_enqueue_scripts( $hook ) {
			if ( in_array( $hook, array( 'post.php', 'post-new.php' ) ) ) {
				$post_types = get_post_types( array( 'public' => true ) );
				$screen     = get_current_screen();
				$post_type  = $screen->id;

				if ( in_array( $post_type, (array) $post_types ) ) {
					/* Directory and Extension */
					$file_prefix = '.min';
					$dir_name    = 'minified';

					if ( SCRIPT_DEBUG ) {
						$file_prefix = '';
						$dir_name    = 'unminified';
					}

					wp_enqueue_script( 'astra-ext-sticky-header-metabox', ASTRA_EXT_STICKY_HEADER_URI . 'assets/js/' . $dir_name . '/metabox' . $file_prefix . '.js', array( 'jquery' ), ASTRA_EXT_VER, true );
				}
			}
		}

User Contributed Notes

You must log in before being able to contribute a note or feedback.