PluginProbe ʕ •ᴥ•ʔ
Post Grid, Slider & Carousel Ultimate – with Shortcode, Gutenberg Block & Elementor Widget / trunk
Post Grid, Slider & Carousel Ultimate – with Shortcode, Gutenberg Block & Elementor Widget vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.7 1.3.8 1.4.0 1.4.1 1.4.2 1.4.3 1.6.0 1.6.1 1.6.10 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7 1.8
post-grid-carousel-ultimate / includes / classes / custom-post.php
post-grid-carousel-ultimate / includes / classes Last commit date
ajax.php 1 month ago custom-post.php 3 years ago metabox.php 2 years ago migration.php 2 years ago resize.php 3 years ago settings.php 4 years ago shortcode.php 1 year ago widget.php 4 years ago
custom-post.php
85 lines
1 <?php
2 /**
3 * Exit if accessed directly
4 */
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit;
7 }
8
9 class PGCU_Custom_Post
10 {
11 public function __construct() {
12 //hook for custom post
13 add_action( 'init', array( $this,'gc_adl_custom_post_type') );
14
15 // shortcode column list
16 add_filter( 'manage_'.PGCU_POST_TYPE.'_posts_columns', array( $this, 'gc_adl_new_post_shortcord_columns' ) );
17 add_action( 'manage_'.PGCU_POST_TYPE.'_posts_custom_column', array( $this, 'gc_adl_manage_shortcode_columns' ), 10, 2 );
18 }
19
20 //method for custom post type
21 public function gc_adl_custom_post_type() {
22
23 $shortcode_label = array(
24 'name' => _x( 'Shortcodes', 'post type general name', PGCU_TEXTDOMAIN ),
25 'singular_name' => _x( 'Shortcode', 'post type singular name', PGCU_TEXTDOMAIN ),
26 'menu_name' => _x( 'Post Grid & Carousel', 'admin menu', PGCU_TEXTDOMAIN ),
27 'name_admin_bar' => _x( 'Shortcode', 'add new on admin bar', PGCU_TEXTDOMAIN ),
28 'add_new' => _x( 'New Grid/Carousel', 'Shortcode', PGCU_TEXTDOMAIN ),
29 'add_new_item' => __( 'New Grid/Carousel', PGCU_TEXTDOMAIN ),
30 'new_item' => __( 'New Grid/Carousel', PGCU_TEXTDOMAIN ),
31 'edit_item' => __( 'Edit Post Grid/Carousel', PGCU_TEXTDOMAIN ),
32 'view_item' => __( 'View Post Grid/Carousel', PGCU_TEXTDOMAIN ),
33 'all_items' => __( 'All Grid/Carousel', PGCU_TEXTDOMAIN ),
34 'search_items' => __( 'Search Shortcodes', PGCU_TEXTDOMAIN ),
35 'parent_item_colon' => __( 'Parent Shortcodes:', PGCU_TEXTDOMAIN ),
36 'not_found' => __( 'No Shortcodes found.', PGCU_TEXTDOMAIN ),
37 'not_found_in_trash' => __( 'No Shortcodes found in Trash.', PGCU_TEXTDOMAIN )
38 );
39
40 $short_args = array(
41 'labels' => $shortcode_label,
42 'description' => __( 'Description.', PGCU_TEXTDOMAIN ),
43 'public' => true,
44 'publicly_queryable' => true,
45 'show_ui' => true,
46 'show_in_menu' => true,
47 'query_var' => true,
48 'rewrite' => array( 'slug' => PGCU_POST_TYPE ),
49 'capability_type' => 'post',
50 'has_archive' => true,
51 'hierarchical' => false,
52 'menu_position' => 20,
53 'supports' => array('title'),
54 'menu_icon' => 'dashicons-schedule'
55 );
56
57 register_post_type( PGCU_POST_TYPE, $short_args );
58
59 }
60
61 //method for shortcode columns
62 public function gc_adl_new_post_shortcord_columns( $columns ) {
63 $columns = array();
64 $columns['cb'] = '<input type="checkbox" />';
65 $columns['title'] = esc_html__('Post Name', PGCU_TEXTDOMAIN);
66 $columns['post_grid_carousel_sc_1'] = esc_html__('Post Shortcode', PGCU_TEXTDOMAIN);
67 $columns['date'] = esc_html__('Created at', PGCU_TEXTDOMAIN);
68 return $columns;
69 }
70
71 /// method for shortcode column list
72 public function gc_adl_manage_shortcode_columns( $column_name, $post_id ) {
73 switch( $column_name ){
74 case 'post_grid_carousel_sc_1': ?>
75 <textarea style="background:#0074A8; color:#fff;" rows="1" onClick="this.select();" >[pgcu id="<?php echo esc_attr( $post_id );?>"]</textarea>
76 <?php
77 break;
78
79 default:
80 break;
81
82 }
83 }
84 }
85