Skip to content

Instantly share code, notes, and snippets.

@ahaywood
Created September 15, 2013 15:33
Show Gist options
  • Save ahaywood/6571804 to your computer and use it in GitHub Desktop.
Save ahaywood/6571804 to your computer and use it in GitHub Desktop.
Adding Date Picker to Admin Custom Post Type This goes in function.php From http://wordpress.stackexchange.com/questions/15656/add-a-jquery-datepicker-to-custom-field-in-post-edit
// Register datepicker ui for properties
function admin_homes_for_sale_javascript(){
global $post;
if($post->post_type == 'homes-for-sale' && is_admin()) {
wp_enqueue_script('jquery-ui-datepicker', WP_CONTENT_URL . '/themes/philosophy/js/jquery-ui-datepicker.min.js');
}
}
add_action('admin_print_scripts', 'admin_homes_for_sale_javascript');
// Register ui styles for properties
function admin_homes_for_sale_styles(){
global $post;
if($post->post_type == 'homes-for-sale' && is_admin()) {
wp_enqueue_style('jquery-ui', WP_CONTENT_URL . '/themes/philosophy/css/jquery-ui-1.8.11.custom.css');
}
}
add_action('admin_print_styles', 'admin_homes_for_sale_styles');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment