| 1 |
<?php |
| 2 |
/** |
| 3 |
* Register the Grid post type. |
| 4 |
* |
| 5 |
* @link https://bootstrapped.ventures |
| 6 |
* @since 3.0.0 |
| 7 |
* |
| 8 |
* @package WP_Ultimate_Post_Grid |
| 9 |
* @subpackage WP_Ultimate_Post_Grid/includes/public |
| 10 |
*/ |
| 11 |
|
| 12 |
/** |
| 13 |
* Register the Grid post type. |
| 14 |
* |
| 15 |
* @since 3.0.0 |
| 16 |
* @package WP_Ultimate_Post_Grid |
| 17 |
* @subpackage WP_Ultimate_Post_Grid/includes/public |
| 18 |
* @author Brecht Vandersmissen <brecht@bootstrapped.ventures> |
| 19 |
*/ |
| 20 |
class WPUPG_Post_Type { |
| 21 |
|
| 22 |
/** |
| 23 |
* Register actions and filters. |
| 24 |
* |
| 25 |
* @since 3.0.0 |
| 26 |
*/ |
| 27 |
public static function init() { |
| 28 |
add_action( 'init', array( __CLASS__, 'register_post_type' ), 1 ); |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* Register the Link post type. |
| 33 |
* |
| 34 |
* @since 3.0.0 |
| 35 |
*/ |
| 36 |
public static function register_post_type() { |
| 37 |
$labels = array( |
| 38 |
'name' => _x( 'Grids', 'post type general name', 'wp-ultimate-post-grid' ), |
| 39 |
'singular_name' => _x( 'Grid', 'post type singular name', 'wp-ultimate-post-grid' ), |
| 40 |
); |
| 41 |
|
| 42 |
$args = apply_filters( 'wpupg_register_post_type', array( |
| 43 |
'labels' => $labels, |
| 44 |
'public' => false, |
| 45 |
'rewrite' => false, |
| 46 |
'capability_type' => 'post', |
| 47 |
'query_var' => false, |
| 48 |
'has_archive' => false, |
| 49 |
'show_in_rest' => true, |
| 50 |
'rest_base' => WPUPG_POST_TYPE, |
| 51 |
'rest_controller_class' => 'WP_REST_Posts_Controller', |
| 52 |
)); |
| 53 |
|
| 54 |
register_post_type( WPUPG_POST_TYPE, $args ); |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
WPUPG_Post_Type::init(); |
| 59 |
|