The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

how to call my register custom post type function in my main plugin file (1 post)

  1. kylemint23
    Posted 3 years ago #

    Hello Guys,

    Can you help me on how can I solved this.
    I have 3 files:
    wp_hotel.php - main plugin file
    wp_hotel-admin.php - for creating admin menus in wordpress dashboard
    wp_hotel-post-type.php -for creating the custom post type

    now the code to call my 2 file in my wp_hotel.php is

    add_action('admin_menu', array('CPHotel_Admin', 'admin_menu'));
    add_action('admin_init', array('CPHotel_PostType', 'custom_post_type'));

    Creating the admin menus in the dashboard works fine, but creating the post type doesn't work

    the custom_post_type() function in my CPHotel_PostType class in wp_hotel-post-type.php is this:

    public static function custom_post_type(){

    my codes in register_hotel_post_type

    public function register_hotel_post_type(){
       $args = array(
       'labels' => array(
       'name' => 'Hotel Rooms',
       'singular_name' => 'Hotel Room',
       'add_new' => 'Add New Hotel Room',
       'add_new_item' => 'Add New Hotel Room',
       'edit_item' => 'Edit Hotel Room',
       'new_item' => 'Add New Hotel Room',
       'view_item' => 'View Hotel Room',
       'search_items' => 'Search Hotel Rooms',
       'not_found' => 'No Hotel Rooms Found',
       'not_found_in_trash' => 'No Hotel Rooms Found in Trash'),
       'query_var' => 'cphotelroom',
       'rewrite' => array('slug' => 'cphotelroom/',),
       'public' => true,
       menu_icon' => plugins_url('wp_customhotelbooking/assets/img/home16.png', __FILE__),
       'supports' => array('title','thumbnail','editor','excerpt','page-attributes',));

    How can I Fixed this....please help...

Topic Closed

This topic has been closed to new replies.

About this Topic