PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.4.2
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.4.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 2.4.2, at includes/class-smart-post-show-post-types.php

124 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly.
4 }
5 /**
6 * Fired during plugin activation
7 *
8 * @link https://smartpostshow.com/
9 * @since 2.2.0
10 *
11 * @package Smart_Post_Show
12 * @subpackage Smart_Post_Show/includes
13 */
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 // Set the Smart post show post type labels.
69 $labels = apply_filters(
70 'sp_post_carousel_post_type_labels',
71 array(
72 'name' => __( 'Manage Shows', 'smart-post-show' ),
73 'singular_name' => __( 'Show', 'smart-post-show' ),
74 'menu_name' => __( 'Smart Post Show', 'smart-post-show' ),
75 'all_items' => __( 'Manage Shows', 'smart-post-show' ),
76 'add_new' => __( 'Add New', 'smart-post-show' ),
77 'add_new_item' => __( 'Add New Show', 'smart-post-show' ),
78 'edit' => __( 'Edit', 'smart-post-show' ),
79 'edit_item' => __( 'Edit Show', 'smart-post-show' ),
80 'new_item' => __( 'New Show', 'smart-post-show' ),
81 'search_items' => __( 'Search Shows', 'smart-post-show' ),
82 'not_found' => __( 'No Shows found', 'smart-post-show' ),
83 'not_found_in_trash' => __( 'No Shows found in Trash', 'smart-post-show' ),
84 'parent' => __( 'Parent Show', 'smart-post-show' ),
85 )
86 );
87 // Set the Smart post show post type arguments.
88 $menu_icon = 'data:image/svg+xml;base64,' . base64_encode(
89 '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 288 288" enable-background="new 0 0 288 288" xml:space="preserve"><path fill="#A0A5AA" d="M262.102,20.977H27.615c-3.195,0-6.638,2.401-6.638,5.63v234.359c0,3.229,3.443,6.057,6.638,6.057h234.487c3.187,0,4.921-2.828,4.921-6.057V26.607C267.023,23.378,265.289,20.977,262.102,20.977z M118.37,53.441h51.26v43.571h-51.26V53.441z M55.15,53.441h51.26v43.571H55.15V53.441z M135.457,235.413H55.15v-46.134h80.307V235.413z M135.457,173.047H55.15v-46.134h80.307V173.047z M235.413,235.413h-80.307v-46.134h80.307V235.413z M235.413,173.047h-80.307v-46.134h80.307V173.047z M235.413,97.012h-51.26V53.441h51.26V97.012z"/><line fill="none" x1="-99" y1="-84" x2="-99" y2="-57"/><line fill="none" x1="-170" y1="61" x2="-170" y2="101"/></svg>'
90 );
91 $args = apply_filters(
92 'sp_post_carousel_post_type_args',
93 array(
94 'label' => __( 'Manage Shows', 'smart-post-show' ),
95 'description' => __( 'Manage Shows', 'smart-post-show' ),
96 'public' => false,
97 'show_ui' => true,
98 'show_in_menu' => true,
99 'menu_icon' => $menu_icon,
100 'hierarchical' => false,
101 'query_var' => false,
102 'menu_position' => 5,
103 'supports' => array( 'title' ),
104 'capabilities' => array(
105 'publish_posts' => $capability,
106 'edit_posts' => $capability,
107 'edit_others_posts' => $capability,
108 'delete_posts' => $capability,
109 'delete_others_posts' => $capability,
110 'read_private_posts' => $capability,
111 'edit_post' => $capability,
112 'delete_post' => $capability,
113 'read_post' => $capability,
114 ),
115 'capability_type' => 'post',
116 // 'rewrite' => true,
117 'labels' => $labels,
118 )
119 );
120
121 register_post_type( 'sp_post_carousel', $args );
122 }
123 }
124