PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 4.0.2
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v4.0.2
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / includes / class-smart-post-show-post-types.php

class-smart-post-show-post-types.php in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.2, at includes/class-smart-post-show-post-types.php

132 lines 4.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Fired during plugin activation
4 *
5 * @link https://wpsmartpost.com/
6 * @since 2.2.0
7 *
8 * @package Smart_Post_Show
9 * @subpackage Smart_Post_Show/includes
10 */
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit; // Exit if accessed directly.
14 }
15 /**
16 * Custom post class to register the carousel.
17 */
18 class Smart_Post_Show_Post_Type {
19
20 /**
21 * The single instance of the class.
22 *
23 * @var self
24 * @since 2.2.0
25 */
26 private static $instance;
27
28 /**
29 * Path to the file.
30 *
31 * @since 2.2.0
32 *
33 * @var string
34 */
35 public $file = __FILE__;
36
37 /**
38 * Holds the base class object.
39 *
40 * @since 2.2.0
41 *
42 * @var object
43 */
44 public $base;
45
46 /**
47 * Allows for accessing single instance of class. Class should only be constructed once per call.
48 *
49 * @since 2.2.0
50 * @static
51 * @return self Main instance.
52 */
53 public static function instance() {
54 if ( is_null( self::$instance ) ) {
55 self::$instance = new self();
56 }
57 return self::$instance;
58 }
59
60 /**
61 * Smart post show post type
62 */
63 public function register_carousel_post_type() {
64 if ( post_type_exists( 'sp_post_carousel' ) ) {
65 return;
66 }
67 $capability = sp_pc_dashboard_capability();
68 $show_ui = current_user_can( $capability ) ? true : false;
69
70 // Set the Smart post show post type labels.
71 $labels = apply_filters(
72 'sp_post_carousel_post_type_labels',
73 array(
74 'name' => __( 'Manage Shows', 'post-carousel' ),
75 'singular_name' => __( 'Show', 'post-carousel' ),
76 'menu_name' => __( 'Smart Post', 'post-carousel' ),
77 'all_items' => __( 'Manage Shows', 'post-carousel' ),
78 'add_new' => __( 'Add New', 'post-carousel' ),
79 'add_new_item' => __( 'Add New Show', 'post-carousel' ),
80 'edit' => __( 'Edit', 'post-carousel' ),
81 'edit_item' => __( 'Edit Show', 'post-carousel' ),
82 'new_item' => __( 'New Show', 'post-carousel' ),
83 'search_items' => __( 'Search Shows', 'post-carousel' ),
84 'not_found' => __( 'No Shows found', 'post-carousel' ),
85 'not_found_in_trash' => __( 'No Shows found in Trash', 'post-carousel' ),
86 'parent' => __( 'Parent Show', 'post-carousel' ),
87 )
88 );
89 // Set the Smart post show post type arguments.
90 $menu_icon = 'data:image/svg+xml;base64,' . base64_encode(
91 '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
92 <path d="M1.25 12.2422C1.25 11.4871 1.8621 10.875 2.61715 10.875H7.75765C8.51271 10.875 9.12481 11.4871 9.12481 12.2422V17.3828C9.12481 18.1379 8.51271 18.75 7.75765 18.75H2.61715C1.8621 18.75 1.25 18.1379 1.25 17.3828V12.2422Z" fill="white"/>
93 <path d="M10.8748 5.1875C10.8748 3.01288 12.6376 1.25 14.8122 1.25C16.9867 1.25 18.7496 3.01288 18.7496 5.1875C18.7496 7.36212 16.9867 9.125 14.8122 9.125C12.6376 9.125 10.8748 7.36212 10.8748 5.1875Z" fill="white"/>
94 <path d="M1.25 2.61719C1.25 1.86211 1.8621 1.25 2.61715 1.25H7.75765C8.51271 1.25 9.12481 1.86211 9.12481 2.61719V7.75781C9.12481 8.51289 8.51271 9.125 7.75765 9.125H2.61715C1.8621 9.125 1.25 8.51289 1.25 7.75781V2.61719Z" fill="white"/>
95 <rect x="10.8752" y="16.9999" width="7.87481" height="1.16667" rx="0.583333" fill="white"/>
96 <rect x="10.8752" y="11.458" width="7.87481" height="1.16667" rx="0.583333" fill="white"/>
97 <rect x="10.8752" y="14.0829" width="7.87481" height="1.16667" rx="0.583333" fill="white"/>
98 </svg>'
99 );
100 $args = apply_filters(
101 'sp_post_carousel_post_type_args',
102 array(
103 'label' => __( 'Manage Shows', 'post-carousel' ),
104 'description' => __( 'Manage Shows', 'post-carousel' ),
105 'public' => false,
106 'show_ui' => $show_ui,
107 'show_in_menu' => $show_ui,
108 'menu_icon' => $menu_icon,
109 'hierarchical' => false,
110 'query_var' => false,
111 'menu_position' => 5,
112 'supports' => array( 'title' ),
113 'capabilities' => array(
114 'publish_posts' => $capability,
115 'edit_posts' => $capability,
116 'edit_others_posts' => $capability,
117 'delete_posts' => $capability,
118 'delete_others_posts' => $capability,
119 'read_private_posts' => $capability,
120 'edit_post' => $capability,
121 'delete_post' => $capability,
122 'read_post' => $capability,
123 ),
124 'capability_type' => 'post',
125 'labels' => $labels,
126 )
127 );
128
129 register_post_type( 'sp_post_carousel', $args );
130 }
131 }
132