Showing posts with label admin side menu. Show all posts
Showing posts with label admin side menu. Show all posts

Wednesday, October 12, 2022

wordpress create custom post type

 Here we create custom post type property. 

functions.php

function my_custom_post_product() {
  $labels = array(
    'name'               => _x( 'Properties', 'post type general name' ),
    'singular_name'      => _x( 'Property', 'post type singular name' ),
    'add_new'            => _x( 'Add New', 'property' ),
    'add_new_item'       => __( 'Add New property' ),
    'edit_item'          => __( 'Edit Property' ),
    'new_item'           => __( 'New Property' ),
    'all_items'          => __( 'All Property' ),
    'view_item'          => __( 'View Property' ),
    'search_items'       => __( 'Search Property' ),
    'not_found'          => __( 'No products found' ),
    'not_found_in_trash' => __( 'No products found in the Trash' ), 
    //'parent_item_colon'  =>  ,
    'menu_name'          => 'Properties'
  );
  $args = array(
    'labels'        => $labels,
    'description'   => 'Holds our products and property specific data',
    'public'        => true,
    'menu_position' => 5,
    'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
    'has_archive'   => true,
  );
  register_post_type( 'property', $args ); 
}
add_action( 'init', 'my_custom_post_product' );


now you can find "Property" menu in admin menu. Now you can use ACF advance custom fields pro plugin to create its metadada.