Skip to content

Instantly share code, notes, and snippets.

@dragipostolovski
Last active April 9, 2021 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dragipostolovski/12fa7d4e2f56e9447cc82b7f99a27c4b to your computer and use it in GitHub Desktop.
Save dragipostolovski/12fa7d4e2f56e9447cc82b7f99a27c4b to your computer and use it in GitHub Desktop.
<?php
function pe_custom_post_product() {
$labels = array(
'name' => _x( 'Products', 'post type general name' ),
'singular_name' => _x( 'Product', 'post type singular name' ),
'add_new' => _x( 'Add New', 'book' ),
'add_new_item' => __( 'Add New Product' ),
'edit_item' => __( 'Edit Product' ),
'new_item' => __( 'New Product' ),
'all_items' => __( 'All Products' ),
'view_item' => __( 'View Product' ),
'search_items' => __( 'Search Products' ),
'not_found' => __( 'No products found' ),
'not_found_in_trash' => __( 'No products found in the Trash' ),
'parent_item_colon' => __( 'Parent product' ),
'menu_name' => 'Products'
);
$args = array(
'labels' => $labels,
'description' => 'Holds our products and product specific data',
'public' => true,
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
'has_archive' => true,
);
register_post_type( 'product', $args );
}
add_action( 'init', 'pe_custom_post_product' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment