Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function jwsqz_cpt() {
- $labels = array(
- 'name' => _x('Squeeze Pages', 'post type general name'),
- 'singular_name' => _x('Squeeze Page', 'post type singular name'),
- 'add_new' => _x('Add New', 'squeeze page'),
- 'add_new_item' => __( 'Add New Squeeze Page' ),
- 'edit_item' => __( 'Edit Squeeze Page' ),
- 'new_item' => __( 'New Squeeze Page' ),
- 'all_items' => __( 'All Squeeze Pages' ),
- 'view_item' => __( 'View Squeeze Page' ),
- 'search_items' => __( 'Search Squeeze Pages' ),
- 'not_found' => __( 'No squeeze pages found' ),
- 'not_found_in_trash' => __( 'No squeeze pages found in Trash' ),
- 'parent_item_colon' => '',
- 'menu_name' => 'Squeeze Page'
- );
- $args = array(
- 'labels' => $labels,
- 'public' => true,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'query_var' => true,
- 'rewrite' => array(
- 'slug' => 'squeeze-page',
- 'with_front' => false
- ),
- 'capability_type' => 'post',
- 'has_archive' => true,
- 'hierarchical' => true,
- 'menu_position' => 5,
- 'supports' => array( 'title', 'revisions' ),
- 'taxonomies' => array( 'category', 'post_tag' ),
- 'show_in_nav_menus' => false
- );
- register_post_type('squeeze_page',$args);
- }
- add_action( 'init', 'jwsqz_cpt' );
- function jwsqz_flush_rewrite_rules() {
- // First, we "add" the custom post type via the above written function.
- // Note: "add" is written with quotes, as CPTs don't get added to the DB,
- // They are only referenced in the post_type column with a post entry,
- // when you add a post of this CPT.
- jwsqz_cpt();
- // ATTENTION: This is *only* done during plugin activation hook in this example!
- // You should *NEVER EVER* do this on every page load!!
- flush_rewrite_rules();
- }
- register_activation_hook( __FILE__, 'jwsqz_flush_rewrite_rules' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement