Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // stylesheet used by all similar meta boxes
- add_action('admin_init','mb_enqueue');
- function mb_enqueue() {
- // Get the globals that tell us where we are in the admin.
- global $pagenow, $typenow;
- // Sometimes $typenow is not available, so let's check and get it if needed.
- if (empty($typenow) && !empty($_GET['post'])) {
- $post = get_post($_GET['post']);
- $typenow = $post->post_type;
- }
- // Only show our scripts on the admin pages they are used on to prevent possible conflicts with other scripts.
- if (($pagenow == 'post.php' || $pagenow == 'post-new.php') && $typenow == 'portfolios') {
- // WP Alchemy Stylesheet
- wp_enqueue_style('custom_meta_css', _TEMPLATEURL . '/lib/admin/metaboxes/mb_style.css');
- // WP Alchemy related JS
- wp_register_script('my-custom_meta_js', _TEMPLATEURL . '/lib/admin/metaboxes/mb_global.js', array('jquery','media-upload','thickbox'));
- wp_enqueue_script('my-custom_meta_js');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement