PluginProbe ʕ •ᴥ•ʔ
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid / trunk
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid vtrunk
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
Notice 3 months ago AdminAjaxController.php 1 year ago MetaController.php 1 year ago NoticeController.php 8 months ago PostTypeController.php 3 months ago SettingsController.php 1 year ago SetupWizardController.php 1 month ago UpgradeController.php 2 years ago
PostTypeController.php
115 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( SetupWizardController::WIZARD_COMPLETED_OPTION ) ) {
34 return;
35 }
36 if ( get_option( 'rttpg_activation_redirect', false ) ) {
37 delete_option( 'rttpg_activation_redirect' );
38 wp_safe_redirect( admin_url( 'edit.php?post_type=rttpg&page=rttpg_settings&section=common-settings' ) );
39 }
40 }
41
42 /**
43 * Register post type
44 *
45 * @return void
46 */
47 public function register_post_types() {
48 $labels = [
49 'name' => esc_html__( 'The Post Grid', 'the-post-grid' ),
50 'singular_name' => esc_html__( 'The Post Grid', 'the-post-grid' ),
51 'add_new' => esc_html__( 'Add New Grid', 'the-post-grid' ),
52 'all_items' => esc_html__( 'All Grids', 'the-post-grid' ),
53 'add_new_item' => esc_html__( 'Add New Post Grid', 'the-post-grid' ),
54 'edit_item' => esc_html__( 'Edit Post Grid', 'the-post-grid' ),
55 'new_item' => esc_html__( 'New Post Grid', 'the-post-grid' ),
56 'view_item' => esc_html__( 'View Post Grid', 'the-post-grid' ),
57 'search_items' => esc_html__( 'Search Post Grids', 'the-post-grid' ),
58 'not_found' => esc_html__( 'No Post Grids found', 'the-post-grid' ),
59 'not_found_in_trash' => esc_html__( 'No Post Grids found in Trash', 'the-post-grid' ),
60 ];
61
62 register_post_type(
63 rtTPG()->post_type,
64 [
65 'labels' => $labels,
66 'public' => false,
67 'show_ui' => true,
68 '_builtin' => false,
69 'capability_type' => 'page',
70 'hierarchical' => true,
71 'menu_icon' => rtTPG()->get_assets_uri( 'images/icon-16x16.png' ),
72 'rewrite' => false,
73 'query_var' => rtTPG()->post_type,
74 'supports' => [
75 'title',
76 ],
77 'show_in_menu' => true,
78 'menu_position' => 20,
79 ]
80 );
81
82 }
83
84 /**
85 * Remove meta box
86 *
87 * @return array
88 */
89 public function remove_all_meta_boxes_tgp_sc() {
90 global $wp_meta_boxes;
91 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']
92 ) {
93
94 $publishBox = $wp_meta_boxes[ rtTPG()->post_type ]['side']['core']['submitdiv'];
95 $scBox = $wp_meta_boxes[ rtTPG()->post_type ]['normal']['high']['rttpg_meta'];
96 $scBoxPreview = $wp_meta_boxes[ rtTPG()->post_type ]['normal']['high']['rttpg_sc_preview_meta'];
97 $docBox = $wp_meta_boxes[ rtTPG()->post_type ]['side']['low']['rt_plugin_sc_pro_information'];
98
99 $wp_meta_boxes[ rtTPG()->post_type ] = [
100 'side' => [
101 'core' => [ 'submitdiv' => $publishBox ],
102 'default' => [
103 'rt_plugin_sc_pro_information' => $docBox,
104 ],
105 ],
106 'normal' => [ 'high' => [ 'submitdiv' => $scBox ] ],
107 'advanced' => [ 'high' => [ 'postexcerpt' => $scBoxPreview ] ],
108 ];
109
110 return [];
111 }
112 }
113
114 }
115