我在wordpress中做自己的主题。
我创建了我的样式和模板文件,如下所示:
问题在于,当我进入帖子时,我没有看到评论表格和重播。
这是我的代码:
header.php
<?php
/**
* wordpress header
*/
?>
<!DOCTYPE html>
<!--[if IE 7]>
<html class="ie ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 7) & !(IE 8)]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta charset = "<?php bloginfo('charset'); ?>" >
<meta name="viewport" content="width=device-width">
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<link rel="stylesheet" href="<?php echo get_template_directory_uri();?>/css/main.css">
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script>
<![endif]-->
<?php if(is_singular()) wp_enqueue_script('commnet-replay' ); ?>
<?php wp_head(); ?>
</head>
<!-- the header -->
<body>
<div id="blog" class="<?php body_class('main');?>">
<div id="main">
<div class="row">
<header class="main-header">
<div class="logo">
<h1><a href="<?php echo home_url();?>"><?php bloginfo('name'); ?></a></h1>
<h2><?php bloginfo('description' ); ?></h2>
</div>
</header>
<nav>
<?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>
</nav>
</div>
footer.php
</div>
</div>
<?php wp_footer(); ?>
</body>
</html>
的index.php
<?php get_header(); ?>
<div class="post">
<?php if(have_posts()) : while (have_posts()) : the_post(); ?>
<h2><a href="<?php the_permalink();?>" title="<?php the_title();?>" rel="bookmark"><?php the_title();?></a></h2>
<span><?php the_author_posts_link(); ?></span>
<time><?php the_time('M d, Y') ?></time>
<span><?php the_category(', ') ?></span>
<?php the_content() ?>
<a href="<?php comment_link();?>"><?php comments_number('0','1','%' );?></a>
<span><?php edit_post_link();?></span>
<?php endwhile; else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
而且,这是comments.php
<?php // Do not delete these lines
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?>
<p class="nocomments">This post is password protected. Enter the password to view comments.</p>
<?php
return;
}
}
?>
<?php if ( 'open' == $post->comment_status ) : ?>
<div id="respond">
<h3><?php comment_form_title(); ?></h3>
<?php cancel_comment_reply_link(); ?>
<?php if ( get_option( 'comment_registration' ) && !$user_ID ) : ?>
<p>You must be <a href="<?php echo wp_login_url( get_permalink() ); ?>">logged in</a> to post a comment.</p>
<?php else : ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<?php if ( $user_ID ) : ?>
<p>Logged in as <a href="<?php echo get_option( 'siteurl' ); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Log out of this account">Log out »</a></p>
<?php else : ?>
<p>
<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="author">Name <?php if ( $req ) echo "( required )"; ?></label>
</p>
<p>
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="email">Email ( <?php if ( $req ) echo "required, "; ?>never shared )</label>
</p>
<p>
<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
<label for="url">Website</label>
</p>
<?php endif; ?>
<p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p>
<p>Some HTML is ok: <code><?php echo allowed_tags(); ?></code></p>
<p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" /></p>
<?php do_action( 'comment_form', $post->ID ); comment_id_fields(); ?>
</form>
<?php endif; // If registration required and not logged in ?>
</div>
<?php endif; // If comments are open: delete this and the sky will fall on your head ?>
任何帮助或暗示???
激活评论所需的任何功能?