Tagged: 

Viewing 3 reply threads
  • Author
    Posts
    • #1466

      I created two custom post types with piklist, then the post in default pages gone, here is my code:

      add_filter(‘piklist_post_types’, ‘product_post_type’);
      function product_post_type($post_types)
      {

      $labels_pro = array(
      ‘name’ => ‘产品’,
      ‘singular_name’ => ‘产品’,
      ‘add_new’ => ‘添加产品’,
      ‘add_new_item’ => ‘添加新产品’,
      ‘edit_item’ => ‘编辑产品’,
      ‘new_item’ => ‘新产品’,
      ‘all_items’ => ‘所有产品’,
      ‘view_item’ => ‘查看产品’,
      ‘search_items’ => ‘搜索产品’,
      ‘not_found’ => ‘没有找到产品’,
      ‘not_found_in_trash’ => ‘没有在回收站中找到产品’,
      ‘parent_item_colon’ => ”,
      ‘menu_name’ => ‘产品’,
      );

      $labels_order = array(
      ‘name’ => ‘订单’,
      ‘singular_name’ => ‘订单’,
      ‘add_new’ => ‘添加订单’,
      ‘add_new_item’ => ‘添加新订单’,
      ‘edit_item’ => ‘编辑订单’,
      ‘new_item’ => ‘新订单’,
      ‘all_items’ => ‘所有订单’,
      ‘view_item’ => ‘查看订单’,
      ‘search_items’ => ‘搜索订单’,
      ‘not_found’ => ‘没有找到订单’,
      ‘not_found_in_trash’ => ‘没有在回收站中找到订单’,
      ‘parent_item_colon’ => ”,
      ‘menu_name’ => ‘订单’,
      );

      $post_types[‘product’] = array(
      ‘labels’ => $labels_pro
      ,’public’ => true
      ,’has_archive’ => true
      ,’show_ui’ => true
      ,’rewrite’ => array(
      ‘slug’ => ‘product’
      ,’with_front’ => true
      )
      ,’supports’ => array(
      ‘title’
      ,’author’
      ,’revisions’
      ,’commentstatus’
      )
      ,’hide_meta_box’ => array(
      ‘slug’
      ,’author’
      )
      ,’edit_columns’ => array(
      ‘title’ => __(‘名称’)
      ,’author’ => __(‘作者’)
      )
      );

      $post_types[‘order’] = array(
      ‘labels’ => $labels_order
      , ‘public’ => false
      , ‘has_archive’ => false
      , ‘show_ui’ => true
      , ‘rewrite’ => array(
      ‘slug’ => ‘order’
      , ‘with_front’ => false
      )
      , ‘supports’ => array(
      ‘title’
      , ‘author’
      , ‘revisions’
      )
      , ‘hide_meta_box’ => array(
      ‘slug’
      , ‘author’
      )
      , ‘edit_columns’ => array(
      ‘title’ => __(‘姓名’)
      )
      );

      return $post_types;
      }

      is there any error? or this is a bug for now?

    • #1468
      Steve
      Keymaster

      @iwillhappy1314– I just updated our doc to reflect registering multiple post types. Let me know if it solves your issue.

    • #1481

      I think the issue is caused by the slug name ,I change “order” to “ord”, the problem resolved.

    • #1484
      Steve
      Keymaster

      We found this as well in some of our projects. WordPress doesn’t like 'slug' => 'order'. I added to the docs for future reference >

Viewing 3 reply threads
  • You must be logged in to reply to this topic.