Wordpress CPT-如何使用post_id来显示帖子而不是帖子类型


Wordpress CPT - how to use post_id to display post instead of post type?

我得到了所有post类型的蛋糕。我需要post_id的帖子。下面是我的自定义帖子类型代码。我的URL是http://localhost:85/wordpress/?cake=cake我需要的是http://localhost:85/wordpress/?cake=19post_id=19的post应该出现。

// making custom post type
function my_custom_post_cakes() {
// setting up labels for custom post type
$labels = array(
    'name'               => _x( 'Cakes', 'post type general name' ),
    'singular_name'      => _x( 'Cake', 'post type singular name' ),
    'add_new'            => _x( 'Add New', 'cake' ),
    'add_new_item'       => __( 'Add New Cakes' ),
    'edit_item'          => __( 'Edit Cake' ),
    'new_item'           => __( 'New Cake' ),
    'all_items'          => __( 'All Cakes' ),
    'view_item'          => __( 'View Cake' ),
    'search_items'       => __( 'Search Cakes' ),
    'not_found'          => __( 'No cakes found' ),
    'not_found_in_trash' => __( 'No cakes found in the Trash' ), 
    'parent_item_colon'  => '',
    'menu_name'          => 'Cakes'
  );
  $args = array(
    'labels'        => $labels,
    'description'   => 'Holds our cakes products data',
    'public'        => true,
    'menu_position' => 5,
    'show_in_nav_menus' => true,
    'capability_type'    => 'post',
    'publicly_queryable' => true,
    'rewrite'            => array( 'slug' => 'cake' ),
    'supports'      => array('title','thumbnail', 'excerpt', 'comments' ),
    'has_archive'   => true,
  );
  register_post_type( 'cake', $args ); 
}
add_action( 'init', 'my_custom_post_cakes' );

将永久链接设置为默认值的最简单方法。请参见路径:
Settings=>permalink , set the default.
谢谢,