do stuff if is custom post type, on admin view
-
Hello,
I’m looking into editing the backend, and would like to have a date picker for the title field, but only for custom post type called recommendations.
I’m loading an extra js file to do it (from functions.php), but can’t target the recommendations post type.
This isn’t working:
function customAdminJavascript() { $admin_script_url = get_settings('siteurl'); $admin_script_url = get_stylesheet_directory_uri() . '/js/admin-script.js'; echo '<!-- custom admin javascript --> <script src="' . $admin_script_url . '"></script> <!--/custom admin javascript -->'; } //Try to spew it out in the header only when editing/writing a recommendation if ('recommendations' == get_post_type()) { add_action('admin_head', 'customAdminJavascript'); }
What sort of conditional statement I should use?
Thanks for all the help ??
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘do stuff if is custom post type, on admin view’ is closed to new replies.