PluginProbe ʕ •ᴥ•ʔ
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid / 4.2.0
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid v4.2.0
7.9.3 7.9.2 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.2.0 4.2.1 4.2.2 4.2.3 5.0.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 6.0.0 7.0.0 7.0.1 7.0.2 7.1.0 7.2.0 7.2.1 7.2.10 7.2.11 7.2.2 7.2.3 7.2.4 7.2.5 7.2.6 7.2.7 7.2.8 7.2.9 7.3.0 7.3.1 7.4.0 7.4.1 7.4.2 7.4.3 7.5.0 7.6.0 7.6.1 7.7.0 7.7.1 7.7.10 7.7.11 7.7.12 7.7.13 7.7.14 7.7.15 7.7.16 7.7.17 7.7.18 7.7.19 7.7.2 7.7.20 7.7.21 7.7.22 7.7.3 7.7.4 7.7.5 7.7.6 7.7.7 7.7.8 7.7.9 7.8.0 7.8.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.9.0 7.9.1
the-post-grid / app / Controllers / Admin / PostTypeController.php
the-post-grid / app / Controllers / Admin Last commit date
AdminAjaxController.php 3 years ago MetaController.php 3 years ago NoticeController.php 3 years ago PostTypeController.php 3 years ago SettingsController.php 3 years ago UpgradeController.php 3 years ago
PostTypeController.php
112 lines
1 <?php
2 /**
3 * Post Type Controller class.
4 *
5 * @package RT_TPG
6 */
7
8 namespace RT\ThePostGrid\Controllers\Admin;
9
10 // Do not allow directly accessing this file.
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit( 'This script cannot be accessed directly.' );
13 }
14
15 /**
16 * Post Type Controller class.
17 */
18 class PostTypeController {
19 /**
20 * Class constructor
21 */
22 public function __construct() {
23 add_action( 'init', [ $this, 'register_post_types' ], 1 );
24 add_action( 'admin_init', [ $this, 'the_post_grid_remove_all_meta_box' ], 9999 );
25 }
26
27 /**
28 * Remove meta box.
29 *
30 * @return void
31 */
32 public function the_post_grid_remove_all_meta_box() {
33 if ( get_option( 'rttpg_activation_redirect', false ) ) {
34 delete_option( 'rttpg_activation_redirect' );
35 wp_safe_redirect( admin_url( 'edit.php?post_type=rttpg&page=rttpg_settings&section=common-settings' ) );
36 }
37 }
38
39 /**
40 * Register post type
41 *
42 * @return void
43 */
44 public function register_post_types() {
45 $labels = [
46 'name' => esc_html__( 'The Post Grid', 'the-post-grid' ),
47 'singular_name' => esc_html__( 'The Post Grid', 'the-post-grid' ),
48 'add_new' => esc_html__( 'Add New Grid', 'the-post-grid' ),
49 'all_items' => esc_html__( 'All Grids', 'the-post-grid' ),
50 'add_new_item' => esc_html__( 'Add New Post Grid', 'the-post-grid' ),
51 'edit_item' => esc_html__( 'Edit Post Grid', 'the-post-grid' ),
52 'new_item' => esc_html__( 'New Post Grid', 'the-post-grid' ),
53 'view_item' => esc_html__( 'View Post Grid', 'the-post-grid' ),
54 'search_items' => esc_html__( 'Search Post Grids', 'the-post-grid' ),
55 'not_found' => esc_html__( 'No Post Grids found', 'the-post-grid' ),
56 'not_found_in_trash' => esc_html__( 'No Post Grids found in Trash', 'the-post-grid' ),
57 ];
58
59 register_post_type(
60 rtTPG()->post_type,
61 [
62 'labels' => $labels,
63 'public' => false,
64 'show_ui' => true,
65 '_builtin' => false,
66 'capability_type' => 'page',
67 'hierarchical' => true,
68 'menu_icon' => rtTPG()->get_assets_uri( 'images/icon-16x16.png' ),
69 'rewrite' => false,
70 'query_var' => rtTPG()->post_type,
71 'supports' => [
72 'title',
73 ],
74 'show_in_menu' => true,
75 'menu_position' => 20,
76 ]
77 );
78
79 }
80
81 /**
82 * Remove meta box
83 *
84 * @return array
85 */
86 public function remove_all_meta_boxes_tgp_sc() {
87 global $wp_meta_boxes;
88 if ( isset( $wp_meta_boxes[ rtTPG()->post_type ]['normal']['high']['rttpg_meta'] ) && $wp_meta_boxes[ rtTPG()->post_type ]['normal']['high']['rttpg_sc_preview_meta'] && $wp_meta_boxes[ rtTPG()->post_type ]['side']['low']['rt_plugin_sc_pro_information']
89 ) {
90
91 $publishBox = $wp_meta_boxes[ rtTPG()->post_type ]['side']['core']['submitdiv'];
92 $scBox = $wp_meta_boxes[ rtTPG()->post_type ]['normal']['high']['rttpg_meta'];
93 $scBoxPreview = $wp_meta_boxes[ rtTPG()->post_type ]['normal']['high']['rttpg_sc_preview_meta'];
94 $docBox = $wp_meta_boxes[ rtTPG()->post_type ]['side']['low']['rt_plugin_sc_pro_information'];
95
96 $wp_meta_boxes[ rtTPG()->post_type ] = [
97 'side' => [
98 'core' => [ 'submitdiv' => $publishBox ],
99 'default' => [
100 'rt_plugin_sc_pro_information' => $docBox,
101 ],
102 ],
103 'normal' => [ 'high' => [ 'submitdiv' => $scBox ] ],
104 'advanced' => [ 'high' => [ 'postexcerpt' => $scBoxPreview ] ],
105 ];
106
107 return [];
108 }
109 }
110
111 }
112