forked from gordielachance/wp-soundsystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwpsstm-core-playlists.php
124 lines (102 loc) · 5.14 KB
/
wpsstm-core-playlists.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
class WP_SoundSystem_Core_Playlists{
/**
* @var The one true Instance
*/
private static $instance;
public $subtracks_static_metaname = 'wpsstm_subtrack_ids';
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new WP_SoundSystem_Core_Playlists;
self::$instance->init();
}
return self::$instance;
}
private function __construct() { /* Do nothing here */ }
function init(){
require wpsstm()->plugin_dir . 'classes/wpsstm-live-tracklist-class.php';
//add_action( 'wpsstm_loaded',array($this,'setup_globals') );
add_action( 'wpsstm_loaded',array($this,'setup_actions') );
}
function setup_actions(){
add_action( 'init', array($this,'register_post_type_playlist' ));
}
function register_post_type_playlist() {
$labels = array(
'name' => _x( 'Playlists', 'Playlists General Name', 'wpsstm' ),
'singular_name' => _x( 'Playlist', 'Playlist Singular Name', 'wpsstm' ),
'menu_name' => __( 'Playlists', 'wpsstm' ),
'name_admin_bar' => __( 'Playlist', 'wpsstm' ),
'archives' => __( 'Playlist Archives', 'wpsstm' ),
'attributes' => __( 'Playlist Attributes', 'wpsstm' ),
'parent_item_colon' => __( 'Parent Playlist:', 'wpsstm' ),
'all_items' => __( 'All Playlists', 'wpsstm' ),
'add_new_item' => __( 'Add New Playlist', 'wpsstm' ),
//'add_new' => __( 'Add New', 'wpsstm' ),
'new_item' => __( 'New Playlist', 'wpsstm' ),
'edit_item' => __( 'Edit Playlist', 'wpsstm' ),
'update_item' => __( 'Update Playlist', 'wpsstm' ),
'view_item' => __( 'View Playlist', 'wpsstm' ),
'view_items' => __( 'View Playlists', 'wpsstm' ),
'search_items' => __( 'Search Playlist', 'wpsstm' ),
//'not_found' => __( 'Not found', 'wpsstm' ),
//'not_found_in_trash' => __( 'Not found in Trash', 'wpsstm' ),
//'featured_image' => __( 'Featured Image', 'wpsstm' ),
//'set_featured_image' => __( 'Set featured image', 'wpsstm' ),
//'remove_featured_image' => __( 'Remove featured image', 'wpsstm' ),
//'use_featured_image' => __( 'Use as featured image', 'wpsstm' ),
'insert_into_item' => __( 'Insert into playlist', 'wpsstm' ),
'uploaded_to_this_item' => __( 'Uploaded to this playlist', 'wpsstm' ),
'items_list' => __( 'Playlists list', 'wpsstm' ),
'items_list_navigation' => __( 'Playlists list navigation', 'wpsstm' ),
'filter_items_list' => __( 'Filter playlists list', 'wpsstm' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'supports' => array( 'author','title','editor','author','thumbnail', 'comments' ),
'taxonomies' => array( 'post_tag' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => false,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
//http://justintadlock.com/archives/2013/09/13/register-post-type-cheat-sheet
'capability_type' => 'post', //playlist
//'map_meta_cap' => true,
/*
'capabilities' => array(
// meta caps (don't assign these to roles)
'edit_post' => 'edit_playlist',
'read_post' => 'read_playlist',
'delete_post' => 'delete_playlist',
// primitive/meta caps
'create_posts' => 'create_playlists',
// primitive caps used outside of map_meta_cap()
'edit_posts' => 'edit_playlists',
'edit_others_posts' => 'manage_playlists',
'publish_posts' => 'manage_playlists',
'read_private_posts' => 'read',
// primitive caps used inside of map_meta_cap()
'read' => 'read',
'delete_posts' => 'manage_playlists',
'delete_private_posts' => 'manage_playlists',
'delete_published_posts' => 'manage_playlists',
'delete_others_posts' => 'manage_playlists',
'edit_private_posts' => 'edit_playlists',
'edit_published_posts' => 'edit_playlists'
),
*/
);
register_post_type( wpsstm()->post_type_playlist, $args );
}
}
function wpsstm_playlists() {
return WP_SoundSystem_Core_Playlists::instance();
}
wpsstm_playlists();