Skip to content

Instantly share code, notes, and snippets.

@kellenmace
Created June 23, 2015 04:10
Show Gist options
  • Select an option

  • Save kellenmace/d87182e26ccc297c5968 to your computer and use it in GitHub Desktop.

Select an option

Save kellenmace/d87182e26ccc297c5968 to your computer and use it in GitHub Desktop.
/*
* Enqueue jQuery when adding/editing a Project Summary
*/
function rpt_enqueue_jquery_for_custom_post_type( $hook ){
global $post;
// if the current post is not a "project_summary" post type, exit this function
if ( 'project_summary' != $post->post_type ) {
return;
}
// if we're not creating or editing the post, exit this function
if( 'post.php' != $hook && 'edit.php' != $hook && 'post-new.php' != $hook)
return;
// otherwise, load jquery
wp_enqueue_script('jquery');
}
add_action( 'admin_enqueue_scripts', 'rpt_enqueue_jquery_for_custom_post_type' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment