【发布时间】:2015-03-06 01:36:54
【问题描述】:
我已将 HTML 模板集成到 Wordpress 主题中。在,菜单区有一个菜单叫做博客。单击该菜单时,我想显示所有帖子。单击某些特定帖子标题时,应该转到单个帖子的页面。在该页面上应该显示某些人较早发布的 cmets,以及可以通过该评论表对该帖子发表评论。
下面是我的 blog.php 代码
<?php
/*
Template Name: Blog
*/
?>
<?php get_header(); ?>
<div id="inner_contant">
<div id="all_post">
<?php
$myposts = get_posts('');
foreach($myposts as $post) :
setup_postdata($post);
?>
<h2><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="author">Posted by <?php the_author(); ?></div>
<div class="post_excerpt"><?php the_excerpt(); ?></div>
<?php endforeach; wp_reset_postdata(); ?>
</div>
</div>
<?php get_footer(); ?>
下面是我的 single.php 代码
<?php
/*
* The template for displaying all single posts and attachments
*/
?>
<?php get_header(); ?>
<div id="single_post_wrap">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<div class="time_and_author"><?php the_time('F jS, Y') ?> by <?php the_author() ?></div>
<div class="post_content"><?php the_content(); ?></div>
<p>Posted in <?php the_category(', ') ?> | <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
<?php endwhile; endif; ?>
<?php foreach (get_comments() as $comment): ?>
<div><?php echo $comment->comment_author; ?> said: "<?php echo $comment->comment_content; ?>".</div>
<?php endforeach; ?>
<?php comments_template(); ?>
</div>
</div>
<?php get_footer(); ?>
下面是我的 cmets.php 代码
<?php $comment_args = array(
'comment_notes_after' => '',
'title_reply' => 'Have something to say?'
) ?>
<?php comment_form($comment_args); ?>
我想为该评论表单添加一些样式。我已经尝试了每件事,但对我没有用。提前感谢那些会帮助我的人。
【问题讨论】:
标签: wordpress