给wordpress新建一个漂亮的留言板

 时间:2024-10-14 12:34:49

1、首先我们用dreamweaver新建一个PHP空白页面,在此页面顶部设置你要建的留言板的名称,代码如下,红色部分就是留言板的名称,可以自己随意取,建议用英文吧,不要纯中文。<?php/*Template Name: liuyanban*/?>

给wordpress新建一个漂亮的留言板

2、 打开你主题的目录,找到page.php页面,然后把里面的代码全部翱务校肢复制过来粘贴到我们第一步新建的留言板页面。第一二步完成后代码如下:<?php/*Template Name: liu烤恤鹇灭yanban*/?><?php get_header(); ?><?php if (have_posts()) : the_post(); update_post_caches($posts); ?> <div id=”post-<?php the_ID(); ?>”> <h2><?php the_title(); ?></h2> <div> <?php edit_post_link(__(‘Edit’, ‘inove’), ‘<span>’, ‘</span>’); ?> <?php if ($comments || comments_open()) : ?> <span><a href=”#respond”><?php _e(‘Leave a comment’, ‘inove’); ?></a></span> <span><a href=”#comments”><?php _e(‘Go to comments’, ‘inove’); ?></a></span> <?php endif; ?> <div></div> </div> <div> <?php the_content(); ?> <div></div> </div> </div> <?php include(‘templates/comments.php’); ?><?php else : ?> <div> <?php _e(‘Sorry, no posts matched your criteria.’, ‘inove’); ?> </div><div id=”comments”><?php comments_template(”,true); ?></div><?php endif; ?><?php get_footer(); ?>

3、在上面的代码里面加上评论调用函数<?php comments_template(”,true); ?>

4、最后得到的留言本代码如下,将此页面存为“liuyanban.php”:<?php/*Template Nam髫潋啜缅e: liuyanban*/?><?php get_header(); ?><?php if (have_posts()) : the_post(); update_post_caches($posts); ?> <div id=”post-<?php the_ID(); ?>”> <h2><?php the_title(); ?></h2> <div> <?php edit_post_link(__(‘Edit’, ‘inove’), ‘<span>’, ‘</span>’); ?> <?php if ($comments || comments_open()) : ?> <span><a href=”#respond”><?php _e(‘Leave a comment’, ‘inove’); ?></a></span> <span><a href=”#comments”><?php _e(‘Go to comments’, ‘inove’); ?></a></span> <?php endif; ?> <div></div> </div> <div> <?php the_content(); ?> <div></div> </div> </div> <?php include(‘templates/comments.php’); ?><?php else : ?> <div> <?php _e(‘Sorry, no posts matched your criteria.’, ‘inove’); ?> </div><div id=”comments”><?php comments_template(”,true); ?></div><?php endif; ?><?php get_footer(); ?>

5、最后到WordPress后台-页面-新建一个页面,命名“留言板”。给此页面选择模板“liuyanban”,页面内容里面随便输入你想要给留言者看的内容就行了。

给wordpress新建一个漂亮的留言板
  • 孕期吃什么东西会导致胎儿畸形
  • 如何将某个excel表格设置为最终版本?
  • 在excel中如何为图表添加标题
  • 学校如何制作自己的在线成绩管理系统?
  • 维生素A有哪些作用?哪些人需要补充维生素A?
  • 热门搜索
    张家界 旅游 山西旅游一卡通 四川旅游路线推荐 济南旅游地图 海南国际旅游岛建设发展规划纲要 泰州旅游景点大全 生态旅游论文 成都自由行旅游攻略 夏季旅游好去处 桂林康辉旅游