RegisterPostTypes.php
40 lines
| 1 | <?php namespace NestedPages\Entities\PostType; |
| 2 | |
| 3 | /** |
| 4 | * Post Types required by Nested Pages |
| 5 | */ |
| 6 | class RegisterPostTypes { |
| 7 | |
| 8 | public function __construct() |
| 9 | { |
| 10 | add_action( 'init', array( $this, 'registerRedirects') ); |
| 11 | } |
| 12 | |
| 13 | |
| 14 | /** |
| 15 | * Redirects Post Type |
| 16 | */ |
| 17 | public function registerRedirects() |
| 18 | { |
| 19 | $labels = array( |
| 20 | 'name' => __('Redirects', 'nestedpages'), |
| 21 | 'singular_name' => __('Redirect', 'nestedpages'), |
| 22 | 'add_new_item'=> 'Add Redirect', |
| 23 | 'edit_item' => 'Edit Redirect', |
| 24 | 'view_item' => 'View Redirect' |
| 25 | ); |
| 26 | $args = array( |
| 27 | 'labels' => $labels, |
| 28 | 'public' => false, |
| 29 | 'show_ui' => false, |
| 30 | 'exclude_from_search' => true, |
| 31 | 'capability_type' => 'post', |
| 32 | 'hierarchical' => true, |
| 33 | 'has_archive' => false, |
| 34 | 'supports' => array('title','editor'), |
| 35 | 'rewrite' => array('slug' => 'np-redirect', 'with_front' => false) |
| 36 | ); |
| 37 | register_post_type( 'np-redirect' , $args ); |
| 38 | } |
| 39 | |
| 40 | } |