Skip to content

Instantly share code, notes, and snippets.

@derekshirk
Last active August 29, 2015 14:21
Show Gist options
  • Save derekshirk/8206930479da994ca84a to your computer and use it in GitHub Desktop.
Save derekshirk/8206930479da994ca84a to your computer and use it in GitHub Desktop.
WP-Conditional_post_type_admin_screens
<?php
add_action( 'admin_enqueue_scripts', 'load_admin_custom_script' );
function load_admin_custom_script() {
$current_screen = get_current_screen();
if ( $current_screen->post_type === 'custom_post_type_name' ) {
$ss_url = get_bloginfo('stylesheet_directory');
wp_enqueue_script('jquery');
wp_enqueue_script('custom_js', '{$ss_url}/path-to-file/filename.js', array('jquery'));
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment