2012-06-06 64 views
0

我已经创建了自定义帖子类型和单个页面模板,它可以正常工作。但是我在为单个页面启用评论时遇到问题。WordPress自定义帖子类型单页(评论)

这是我的函数:

add_action('init', 'vblog'); 
    function vblog() { 
    register_post_type('vblog', array(
    'labels' => array(
      'name' => __('VTV'), 
      'singular_name' => __('VTV'), 
      'add_new' => 'Add New VBlog', 
      'add_new_item' => 'Add New VBlog', 
      'edit' => 'Edit VBlog', 
      'edit_item' => 'Edit VBlog', 
      'new_item' => 'New VBlog', 
      'view' => 'View VBlogs', 
      'view_item' => 'View VBlog', 
      'search_iteme' => 'Search VBlogs', 
      'not_found' => 'No VBlogs Found', 
      'not_found_in_trash' => 'No VBlogs found in Trash', 
      'parent' => 'Parent VBlog', 
    ), 
    'public' => true, 
    'supports' => array('title', 'editor','custom-fields', 'thumbnail', 'revisions', 'comments'), 
    'taxonomies' => array('category', 'post_tag') 
)); 

}

所以我确信,我支持阵列中增加了 “意见”。请帮助!!!

+1

自定义后类型的单一模板评论。就像'<?php comments_template('',true); ?>' – tamilsweet

回答

0

作为回答扩展评论。

您已正确注册了post_type以支持评论。在您的单一{post_type} .php模板中,您需要调用循环内的注释模板(在endwhile和else endif之间)。

if (comments_open() || '0' != get_comments_number()) 
     comments_template('', true); 
0

添加以下代码单vblog.php

comments_template('', true); 

如果显示评论关闭,你可以在phpMyAdmin运行此命令是否已加入

UPDATE wp_posts SET comment_status = 'open' WHERE post_type = 'vblog'; 
相关问题