/** * Whether the current request is in post type pages * * @param mixed $post_types * @return bool True if inside post type pages */ function theme_is_post_type($post_types = '') { if (theme_is_post_type_list($post_types) || theme_is_post_type_new($post_types) || theme_is_post_type_edit($post_types) || theme_is_post_type_post($post_types) || theme_is_post_type_taxonomy($post_types)) { return true; } else { return false; } }
/*-----------------------------------------------------------------------------------*/ function edit_slideshow_columns($slideshow_columns) { $columns = array("cb" => "<input type=\"checkbox\" />", "title" => _x('Slider Item Title', 'column name', 'striking_admin'), "author" => __('Author', 'striking_admin'), "date" => __('Date', 'striking_admin'), "thumbnail" => __('Thumbnail', 'striking_admin')); return $columns; } add_filter('manage_edit-slideshow_columns', 'edit_slideshow_columns'); function manage_slideshow_columns($column) { global $post; if ($post->post_type == "slideshow") { switch ($column) { case 'thumbnail': echo the_post_thumbnail('thumbnail'); break; } } } add_action('manage_posts_custom_column', 'manage_slideshow_columns', 10, 2); /*-----------------------------------------------------------------------------------*/ /* Add image size for slideshow */ /*-----------------------------------------------------------------------------------*/ if (isset($_REQUEST['post_id']) && get_post_type($_REQUEST['post_id']) == 'slideshow' || isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') { add_image_size('slideshow', 960, 440, true); } /*-----------------------------------------------------------------------------------*/ /* Add scripts and styles for slideshow */ /*-----------------------------------------------------------------------------------*/ if (theme_is_post_type_edit('slideshow') || theme_is_post_type_new('slideshow')) { wp_deregister_script('autosave'); }
if ($image) { $meta = wp_get_attachment_metadata($attachment_id); $date = mysql2date(get_option('date_format'), $image->post_date); $size = $meta['width'] . ' x ' . $meta['height'] . 'pixel'; include THEME_ADMIN_AJAX . '/gallery-image-item.php'; } } /*-----------------------------------------------------------------------------------*/ /* Add scripts and styles for gallery */ /*-----------------------------------------------------------------------------------*/ function gallery_add_scripts_and_styles() { wp_deregister_script('autosave'); wp_register_script('theme-gallery', THEME_ADMIN_ASSETS_URI . '/js/gallery.js', array('jquery-ui-sortable')); wp_enqueue_script('theme-gallery'); wp_register_style('theme-gallery', THEME_ADMIN_ASSETS_URI . '/css/gallery.css'); wp_enqueue_style('theme-gallery'); add_thickbox(); } if (theme_is_post_type_edit('gallery') || theme_is_post_type_new('gallery')) { gallery_add_scripts_and_styles(); } if (isset($_GET['gallery_image_upload']) || isset($_POST['gallery_image_upload'])) { include_once THEME_ADMIN_FUNCTIONS . '/gallery-media-upload.php'; } if (isset($_GET['gallery_edit_image'])) { wp_register_script('theme-gallery-edit-image', THEME_ADMIN_ASSETS_URI . '/js/gallery-edit-image.js'); wp_enqueue_script('theme-gallery-edit-image'); wp_register_style('theme-gallery-edit-image', THEME_ADMIN_ASSETS_URI . '/css/gallery-edit-image.css'); wp_enqueue_style('theme-gallery-edit-image'); }
function add_script() { if (theme_is_post_type_new($this->config['pages']) || theme_is_post_type_post($this->config['pages'])) { wp_enqueue_script('shortcode', THEME_ADMIN_ASSETS_URI . '/js/shortcode.js', array('jquery')); } }