示例#1
0
/**
 * Register video post type and attach hooks to load related functionality.
 *
 * @since 1.0.0
 * @uses register_post_type()
 */
function audiotheme_videos_init()
{
    register_taxonomy('audiotheme_video_category', 'audiotheme_video', array('args' => array('orderby' => 'term_order'), 'hierarchical' => true, 'labels' => array('name' => _x('Categories', 'taxonomy general name', 'audiotheme'), 'singular_name' => _x('Category', 'taxonomy singular name', 'audiotheme'), 'search_items' => __('Search Categories', 'audiotheme'), 'popular_items' => __('Popular Categories', 'audiotheme'), 'all_items' => __('All Categories', 'audiotheme'), 'parent_item' => __('Parent Category', 'audiotheme'), 'parent_item_colon' => __('Parent Category:', 'audiotheme'), 'edit_item' => __('Edit Category', 'audiotheme'), 'view_item' => __('View Category', 'audiotheme'), 'update_item' => __('Update Category', 'audiotheme'), 'add_new_item' => __('Add New Category', 'audiotheme'), 'new_item_name' => __('New Category Name', 'audiotheme'), 'separate_items_with_commas' => __('Separate categories with commas', 'audiotheme'), 'add_or_remove_items' => __('Add or remove categories', 'audiotheme'), 'choose_from_most_used' => __('Choose from most used categories', 'audiotheme'), 'menu_name' => __('Categories', 'audiotheme')), 'meta_box_cb' => 'audiotheme_taxonomy_checkbox_list_meta_box', 'public' => true, 'query_var' => true, 'rewrite' => array('slug' => get_audiotheme_videos_rewrite_base() . '/category', 'with_front' => false), 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => false));
    // Register the video custom post type.
    register_post_type('audiotheme_video', array('has_archive' => get_audiotheme_videos_rewrite_base(), 'hierarchical' => true, 'labels' => array('name' => _x('Videos', 'post type general name', 'audiotheme'), 'singular_name' => _x('Video', 'post type singular name', 'audiotheme'), 'add_new' => _x('Add New', 'video', 'audiotheme'), 'add_new_item' => __('Add New Video', 'audiotheme'), 'edit_item' => __('Edit Video', 'audiotheme'), 'new_item' => __('New Video', 'audiotheme'), 'view_item' => __('View Video', 'audiotheme'), 'search_items' => __('Search Videos', 'audiotheme'), 'not_found' => __('No videos found', 'audiotheme'), 'not_found_in_trash' => __('No videos found in Trash', 'audiotheme'), 'all_items' => __('All Videos', 'audiotheme'), 'menu_name' => __('Videos', 'audiotheme'), 'name_admin_bar' => _x('Video', 'add new on admin bar', 'audiotheme')), 'menu_icon' => audiotheme_encode_svg('admin/images/dashicons/videos.svg'), 'menu_position' => 514, 'public' => true, 'publicly_queryable' => true, 'register_meta_box_cb' => 'audiotheme_video_meta_boxes', 'rewrite' => array('slug' => get_audiotheme_videos_rewrite_base(), 'with_front' => false), 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => false, 'supports' => array('title', 'editor', 'thumbnail', 'excerpt', 'comments', 'revisions', 'author')));
    add_action('pre_get_posts', 'audiotheme_video_query_sort');
    add_action('pre_get_posts', 'audiotheme_video_default_template_query');
    add_action('template_include', 'audiotheme_video_template_include');
    add_action('delete_attachment', 'audiotheme_video_delete_attachment');
    add_filter('post_class', 'audiotheme_video_archive_post_class');
}
示例#2
0
/**
 * Add the admin menu items for gigs.
 *
 * @since 1.0.0
 */
function audiotheme_gigs_admin_menu()
{
    global $pagenow, $plugin_page, $typenow;
    // Redirect the default Manage Gigs screen.
    if ('audiotheme_gig' === $typenow && 'edit.php' === $pagenow) {
        wp_safe_redirect(esc_url_raw(get_audiotheme_gig_admin_url()));
        exit;
    }
    $gig_object = get_post_type_object('audiotheme_gig');
    $venue_object = get_post_type_object('audiotheme_venue');
    // Remove the default gigs menu item and replace it with the screen using the custom post list table.
    remove_submenu_page('audiotheme-gigs', 'edit.php?post_type=audiotheme_gig');
    $manage_gigs_hook = add_menu_page($gig_object->labels->name, $gig_object->labels->menu_name, 'edit_posts', 'audiotheme-gigs', 'audiotheme_gigs_manage_screen', audiotheme_encode_svg('admin/images/dashicons/gigs.svg'), 512);
    add_submenu_page('audiotheme-gigs', $gig_object->labels->name, $gig_object->labels->all_items, 'edit_posts', 'audiotheme-gigs', 'audiotheme_gigs_manage_screen');
    $edit_gig_hook = add_submenu_page('audiotheme-gigs', $gig_object->labels->add_new_item, $gig_object->labels->add_new, 'edit_posts', 'post-new.php?post_type=audiotheme_gig');
    $manage_venues_hook = add_submenu_page('audiotheme-gigs', $venue_object->labels->name, $venue_object->labels->menu_name, 'edit_posts', 'audiotheme-venues', 'audiotheme_venues_manage_screen');
    $edit_venue_hook = add_submenu_page('audiotheme-gigs', $venue_object->labels->add_new_item, $venue_object->labels->add_new_item, 'edit_posts', 'audiotheme-venue', 'audiotheme_venue_edit_screen');
    add_filter('parent_file', 'audiotheme_gigs_admin_menu_highlight');
    add_action('load-' . $manage_gigs_hook, 'audiotheme_gigs_manage_screen_setup');
    add_action('load-' . $edit_gig_hook, 'audiotheme_gig_edit_screen_setup');
    add_action('load-' . $manage_venues_hook, 'audiotheme_venues_manage_screen_setup');
    add_action('load-' . $edit_venue_hook, 'audiotheme_venue_edit_screen_setup');
}
示例#3
0
/**
 * Build the framework admin menu.
 *
 * @since 1.0.0
 */
function audiotheme_dashboard_admin_menu()
{
    $pagehook = add_menu_page(__('AudioTheme', 'audiotheme'), __('AudioTheme', 'audiotheme'), 'edit_posts', 'audiotheme', 'audiotheme_dashboard_features_screen', audiotheme_encode_svg('admin/images/dashicons/audiotheme.svg'), 3.901);
    add_submenu_page('audiotheme', __('Features', 'audiotheme'), __('Features', 'audiotheme'), 'edit_posts', 'audiotheme', 'audiotheme_dashboard_features_screen');
}
示例#4
0
/**
 * Discography admin menu.
 *
 * @since 1.0.0
 */
function audiotheme_discography_admin_menu()
{
    add_menu_page(__('Discography', 'audiotheme'), __('Discography', 'audiotheme'), 'edit_posts', 'edit.php?post_type=audiotheme_record', null, audiotheme_encode_svg('admin/images/dashicons/discography.svg'), 513);
}