【发布时间】:2011-09-29 22:43:36
【问题描述】:
我创建了一个自定义帖子类型,我想显示并允许 cmets。
我在 function.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' );
在我的 theme-post-types.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" ) );
最后在我的 theme-cmets.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>
在我的自定义帖子类型中我有:
<div id="tabs-3">
<?php comments_template(); ?>
</div>
自定义帖子显示内容,但未显示 cmets 或评论表单...有什么想法吗?
【问题讨论】: