2017-09-16 19:32
浏览 25


I have a CPT called businesses and have created posts within that however, when I click on any of the posts, they show a blank page. Anyone know why?

//create a custom post type for new businesses
function create_businesses() {
      $labels = array(
        'name'                  => 'Our Businiesses',
        'singular_name'         => 'Our Businesses',
        'add_new_item'          => 'Add A New Business', 'chandco',
        'new_item'              => 'New Business', 'chandco',
        'edit_item'             => 'Edit Business', 'chandco',
        'view_item'             => 'View Business', 'chandco',
        'all_items'             => 'All Businesses', 'chandco',
        'add_new'               => 'Add A New Business', 'chandco'
      $args = array(
        'labels' => $labels,
        'public' => true,
        'has_archive' => true,
        'capability_type' => 'post',
        'supports' => array('title', 'editor', 'thumbnail'),
        'rewrite' => array( 'slug' => 'businesses' ),
    register_post_type( 'businesses', $args);
add_action( 'init', 'create_businesses' );

图片转代码服务由CSDN问答提供 功能建议

我有一个名为business的CPT并在其中创建了帖子但是,当我点击任何帖子时,他们 显示空白页面。 有谁知道为什么?

 $ labels = array(
'  name'=&gt;'我们的业务'',
'new_item'=&gt;  '新业务','chandco',
'all_items'=&gt  ;'所有业务','chandco',
 $ args = array(
'labels'=&gt; $ labels,  
'public'=&gt; true,
'has_archive'=&gt; true,
'支持'=&gt;数组('title','editor',  'thumbnail'),
 register_post_  type('business',$ args); 
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongren7374 2017-09-16 19:50

    According to Wordpress standard, this output will handle by the "single.php" file ( Common file for all posts single view ).

    But if you are getting blank page then you can try again by creating the specific file for the "businesses" custom post type posts.

    Create a file called "single-businesses.php" file. So now if you click on any of the posts, Wordpress will call this specific file and generate the output.

    解决 无用
    打赏 举报

相关推荐 更多相似问题