PluginProbe ʕ •ᴥ•ʔ
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid / 4.1.0
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid v4.1.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 4 years ago MetaController.php 4 years ago NoticeController.php 4 years ago PostTypeController.php 4 years ago SettingsController.php 4 years ago UpgradeController.php 4 years ago
PostTypeController.php
95 lines
1 <?php
2
3
4 namespace RT\ThePostGrid\Controllers\Admin;
5
6 class PostTypeController {
7
8 public function __construct() {
9 add_action( 'init', [ &$this, 'register_post_types' ], 1 );
10 add_action( 'admin_init', [ &$this, 'the_post_grid_remove_all_meta_box' ], 9999 );
11 }
12
13 public function the_post_grid_remove_all_meta_box() {
14 if ( is_admin() && apply_filters( 'rttpg_remove_all_extra_metabox_from_shordcode', true ) ) {
15 add_filter( "get_user_option_meta-box-order_" . rtTPG()->post_type,
16 [
17 &$this,
18 'remove_all_meta_boxes_tgp_sc',
19 ] );
20 }
21
22 if ( get_option( 'rttpg_activation_redirect', false ) ) {
23 delete_option( 'rttpg_activation_redirect' );
24 wp_redirect( admin_url( 'edit.php?post_type=rttpg&page=rttpg_settings&section=common-settings' ) );
25 }
26 }
27
28 public function register_post_types() {
29
30 // Create the post grid post type
31 $labels = [
32 'name' => __( 'The Post Grid', 'the-post-grid' ),
33 'singular_name' => __( 'The Post Grid', 'the-post-grid' ),
34 'add_new' => __( 'Add New Grid', 'the-post-grid' ),
35 'all_items' => __( 'All Grids', 'the-post-grid' ),
36 'add_new_item' => __( 'Add New Post Grid', 'the-post-grid' ),
37 'edit_item' => __( 'Edit Post Grid', 'the-post-grid' ),
38 'new_item' => __( 'New Post Grid', 'the-post-grid' ),
39 'view_item' => __( 'View Post Grid', 'the-post-grid' ),
40 'search_items' => __( 'Search Post Grids', 'the-post-grid' ),
41 'not_found' => __( 'No Post Grids found', 'the-post-grid' ),
42 'not_found_in_trash' => __( 'No Post Grids found in Trash', 'the-post-grid' ),
43 ];
44
45 register_post_type( rtTPG()->post_type,
46 [
47 'labels' => $labels,
48 'public' => false,
49 'show_ui' => true,
50 '_builtin' => false,
51 'capability_type' => 'page',
52 'hierarchical' => true,
53 'menu_icon' => rtTPG()->get_assets_uri( 'images/icon-16x16.png' ),
54 'rewrite' => false,
55 'query_var' => rtTPG()->post_type,
56 'supports' => [
57 'title',
58 ],
59 'show_in_menu' => true,
60 'menu_position' => 20,
61 ] );
62
63
64 }
65
66
67 /**
68 * @return void|array
69 */
70 public function remove_all_meta_boxes_tgp_sc() {
71 global $wp_meta_boxes;
72 if ( isset( $wp_meta_boxes[ rtTPG()->post_type ]['normal']['high']['rttpg_meta'] ) && $wp_meta_boxes[ rtTPG()->post_type ]['normal']['high']['rttpg_sc_preview_meta']
73 && $wp_meta_boxes[ rtTPG()->post_type ]['side']['low']['rt_plugin_sc_pro_information']
74 ) {
75 $publishBox = $wp_meta_boxes[ rtTPG()->post_type ]['side']['core']['submitdiv'];
76 $scBox = $wp_meta_boxes[ rtTPG()->post_type ]['normal']['high']['rttpg_meta'];
77 $scBoxPreview = $wp_meta_boxes[ rtTPG()->post_type ]['normal']['high']['rttpg_sc_preview_meta'];
78 $docBox = $wp_meta_boxes[ rtTPG()->post_type ]['side']['low']['rt_plugin_sc_pro_information'];
79
80 $wp_meta_boxes[ rtTPG()->post_type ] = [
81 'side' => [
82 'core' => [ 'submitdiv' => $publishBox ],
83 'default' => [
84 'rt_plugin_sc_pro_information' => $docBox,
85 ],
86 ],
87 'normal' => [ 'high' => [ 'submitdiv' => $scBox ] ],
88 'advanced' => [ 'high' => [ 'postexcerpt' => $scBoxPreview ] ],
89 ];
90
91 return [];
92 }
93 }
94
95 }