View difference between Paste ID: k7QvxKLi and 2z6fqN9a
SHOW: | | - or go back to the newest paste.
1
	function jwsqz_cpt() {
2
		
3
		$labels = array(
4
			'name' => _x('Squeeze Pages', 'post type general name'),
5
			'singular_name' => _x('Squeeze Page', 'post type singular name'),
6
			'add_new' => _x('Add New', 'squeeze page'),
7
			'add_new_item' => __( 'Add New Squeeze Page' ),
8
			'edit_item' => __( 'Edit Squeeze Page' ),
9
			'new_item' => __( 'New Squeeze Page' ),
10
			'all_items' => __( 'All Squeeze Pages' ),
11
			'view_item' => __( 'View Squeeze Page' ),
12
			'search_items' => __( 'Search Squeeze Pages' ),
13
			'not_found' =>  __( 'No squeeze pages found' ),
14-
			'not_found_in_trash' => __( 'No squeeze pages found in Trash', self::LANG ), 
14+
			'not_found_in_trash' => __( 'No squeeze pages found in Trash' ), 
15
			'parent_item_colon' => '',
16
			'menu_name' => 'Squeeze Page'
17
		);
18
		$args = array(
19
			'labels' => $labels,
20
			'public' => true,
21
			'publicly_queryable' => true,
22
			'show_ui' => true, 
23
			'show_in_menu' => true, 
24
			'query_var' => true,
25
			'rewrite' => array(
26
				'slug' => 'squeeze-page',
27
				'with_front' => false
28
			),
29
			'capability_type' => 'post',
30
			'has_archive' => true, 
31
			'hierarchical' => true,
32
			'menu_position' => 5,
33
			'supports' => array( 'title', 'revisions' ),
34
			'taxonomies' => array( 'category', 'post_tag' ),
35
			'show_in_nav_menus' => false
36
		);
37
		
38
		register_post_type('squeeze_page',$args);
39
	}
40
	add_action( 'init', 'jwsqz_cpt' );
41
	
42
	function jwsqz_flush_rewrite_rules()  {
43
		
44
		// First, we "add" the custom post type via the above written function.
45
		// Note: "add" is written with quotes, as CPTs don't get added to the DB,
46
		// They are only referenced in the post_type column with a post entry, 
47
		// when you add a post of this CPT.
48
		jwsqz_cpt();
49
		
50
		// ATTENTION: This is *only* done during plugin activation hook in this example!
51
		// You should *NEVER EVER* do this on every page load!!
52
		flush_rewrite_rules();
53
		
54
	}
55
	register_activation_hook( __FILE__, 'jwsqz_flush_rewrite_rules' );