PluginProbe
StreamCast – bring live radio to your site with a sleek player / 2.2.3
StreamCast – bring live radio to your site with a sleek player v2.2.3
2.4.5 2.4.4 trunk 1.0 1.1 2.0.0 2.1.10 2.1.2 2.1.4 2.1.5 2.1.8 2.2.1 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 All 29 releases
streamcast / inc / cpt.php

cpt.php in StreamCast – bring live radio to your site with a sleek player 2.2.3, at inc/cpt.php

131 lines 6.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3 /* Register Custom Post Types */
4
5 add_action( 'init', 'stp_create_post_type' );
6 function stp_create_post_type() {
7 register_post_type( 'streamcast',
8 array(
9 'labels' => array(
10 'name' => __( 'StreamCast'),
11 'singular_name' => __( 'StreamCast' ),
12 'add_new' => __( 'Add New Radio Player' ),
13 'add_new_item' => __( 'Add New Radio' ),
14 'edit_item' => __( 'Edit Radio' ),
15 'new_item' => __( 'New Radio' ),
16 'view_item' => __( 'View Portfolio' ),
17 'search_items' => __( 'Search Portfolio'),
18 'not_found' => __( 'Sorry, we couldn\'t find the Portfolio you are looking for.' )
19 ),
20 'public' => false,
21 'show_ui' => true,
22 'publicly_queryable' => true,
23 'exclude_from_search' => true,
24 'menu_position' => 14,
25 'menu_icon' =>'dashicons-microphone',
26 'has_archive' => false,
27 'hierarchical' => false,
28 'capability_type' => 'page',
29 'rewrite' => array( 'slug' => 'behance' ),
30 'supports' => array( 'title' )
31 )
32 );
33 }
34
35
36 //Remove post update massage and link
37 function stp_updated_messages( $messages ) {
38 $messages['streamcast'][1] = __('Updated ');
39 return $messages;
40 }
41 add_filter('post_updated_messages','stp_updated_messages');
42
43 /*-------------------------------------------------------------------------------*/
44 /* Hide & Disabled View, Quick Edit and Preview Button
45 /*-------------------------------------------------------------------------------*/
46 function stp_remove_row_actions( $idtions ) {
47 global $post;
48 if( $post->post_type == 'streamcast' ) {
49 unset( $idtions['view'] );
50 unset( $idtions['inline hide-if-no-js'] );
51 }
52 return $idtions;
53 }
54
55 if ( is_admin() ) {
56 add_filter( 'post_row_actions','stp_remove_row_actions', 10, 2 );}
57
58 // HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button
59 function stp_hide_publishing_actions(){
60 $my_post_type = 'streamcast';
61 global $post;
62 if($post->post_type == $my_post_type){
63 echo '
64 <style type="text/css">
65 #misc-publishing-actions,
66 #minor-publishing-actions{
67 display:none;
68 }
69 </style>
70 ';
71 }
72 }
73 add_action('admin_head-post.php', 'stp_hide_publishing_actions');
74 add_action('admin_head-post-new.php', 'stp_hide_publishing_actions');
75
76 // Change publish button to save.
77 add_filter( 'gettext', 'stp_change_publish_button', 10, 2 );
78
79 function stp_change_publish_button( $translation, $text ) {
80 if ( 'streamcast' == get_post_type())
81 if ( $text == 'Publish' )
82 return 'Save';
83
84 return $translation;
85 }
86
87 // column management
88 add_filter('manage_streamcast_posts_columns', 'stp_columns_head_only_streamcast', 10);
89 add_action('manage_streamcast_posts_custom_column', 'stp_columns_content_only_streamcast', 10, 2);
90
91 function stp_columns_head_only_streamcast($defaults) {
92 $defaults['directors_name'] = 'ShortCode';
93 return $defaults;
94 }
95 function stp_columns_content_only_streamcast($column_name, $post_ID) {
96 if ($column_name == 'directors_name') {
97 // show content of 'directors_name' column
98 echo '<input onClick="this.select();" value="[radio_player id='. esc_attr($post_ID) . ']" >';
99 }
100 }
101
102 // Add shortcode area
103
104 add_action( 'edit_form_after_title', 'stp_shortcode_area' );
105 function stp_shortcode_area() {
106 global $post;
107 if ( $post->post_type == 'streamcast' ) {
108 ?>
109 <style>
110 #btss_meta .postbox-header{display:none}.bshortcode{margin-top:30px;border:5px solid #4527a4;overflow:hidden}.shortcode-heading{background:#4527a4;padding:15px;overflow:hidden;color:#fff}.shortcode-heading .icon{float:left;overflow:hidden;width:50%}.shortcode-heading .text{float:right;overflow:hidden;text-align:right}.shortcode-heading .text a{color:#fff;display:block;text-decoration:none}.bshortcode .shortcode-left{width:50%;float:left;overflow:hidden;padding:20px 0 30px;text-align:center;background:#fff;border-right:5px solid #4527a4;box-sizing:border-box}.bshortcode .shortcode-right{width:50%;float:left;overflow:hidden;padding:20px 0 30px;text-align:center;background:#fff}.bshortcode .shortcode{padding:8px 15px;background:#eae6f9;display:inline-block;user-select:all;font-size:16px}
111 </style>
112
113 <div class="bshortcode">
114 <div class="shortcode-heading">
115 <div class="icon"><span class="dashicons dashicons-format-audio"></span> <?php _e( 'Radio Player', 'radio-player' )?></div>
116 <div class="text"> <a href="https://bplugins.com/support/" target="_blank"><?php _e( 'Supports', 'radio-player' )?></a></div>
117 </div>
118 <div class="shortcode-left">
119 <h3><?php _e( 'Shortcode', 'radio-player' )?></h3>
120 <p><?php _e( 'Copy and paste this shortcode into your posts or pages or widget content:', 'radio-player' )?></p>
121 <div class="shortcode" selectable>[radio_player id='<?php echo esc_attr($post->ID); ?>']</div>
122 </div>
123 <div class="shortcode-right">
124 <h3><?php _e( 'Template Include', 'radio-player' )?></h3>
125 <p><?php _e( 'Copy and paste the PHP code into your template file:', 'radio-player' )?></p>
126 <div class="shortcode">&lt;?php echo do_shortcode('[radio_player id="<?php echo esc_attr($post->ID); ?>"]');
127 ?&gt;</div>
128 </div>
129 </div>
130 <?php
131 }}