我已经创建了一个自定义的帖子类型,我想显示并允许评论。
我有这个功能。php:
// Add Custom Post Types
add_action( \'init\', \'thm_post_types\' );
// Add Custom Post Types Function
require_once ( THEME_INCLUDES . \'theme-post-types.php\' );
require_once ( THEME_INCLUDES . \'theme-comments.php\' );
在我的主题帖子类型中。php我有:
register_post_type( \'product\',
array(
\'labels\' => array(
\'name\' => \'Product Items\',
\'singular_name\' => \'Product\' ,
\'add_new\' => \'Add New Product\',
\'add_new_item\' => \'Add New Product Item\' ,
\'edit\' => \'Edit Product\',
\'edit_item\' => \'Edit Product Item\',
),
\'description\' => \'Product Items.\' ,
\'public\' => true,
\'supports\' => array( \'title\', \'editor\', \'thumbnail\', \'custom-fields\' ), // ***** i believe this is the problem ******
\'taxonomies\' => array(\'category\', \'post_tag\')
)
);
register_taxonomy( \'product_category\', array( \'product\' ), array( \'label\' => "Categories", "singular_label" => "Category" ) );
最后在我的主题评论中。php:
function thm_format_comment($comment, $args, $depth) {
$GLOBALS[\'comment\'] = $comment; ?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
<div class="comment" id="comment-<?php comment_ID() ?>">
<div class="avatar"><?php echo get_avatar( $comment, $size=\'80\' ); ?>
<?php comment_reply_link( array_merge( $args, array( \'depth\' => $depth, \'max_depth\' => $args[\'max_depth\'] ) ) ) ?>
</div>
<div class="comment-text">
<cite><?php comment_author_link(); ?></cite>
<small><?php comment_date( \'F d, Y - G:i \' ); ?></small>
<div class="separator-line" style="margin-bottom:10px; margin-top:5px;"></div>
<?php if ($comment->comment_approved == \'0\') : ?>
<p><em><?php _e( \'Your comment is awaiting moderation.\' ); ?></em></p>
<?php endif; ?>
<?php comment_text() ?>
</div>
<div class="clear"></div>
</div>
</li>
在我的自定义帖子类型php中,我有:
<div id="tabs-3">
<?php comments_template(); ?>
</div>
自定义帖子显示内容,但不显示评论或评论表单。。。有什么想法吗?