首页 > WordPress教程_wordpress建站视频教程 > 如何制作wordpress留言板?

WordPress教程_wordpress建站视频教程

如何制作wordpress留言板?

发布:E时代科技  分类:WordPress教程_wordpress建站视频教程 浏览:3321 次

  如何制作wordpress留言板?厦门网站建设公司总结步骤如下:

  1.找到模板目录中的single.php文件,复制single.php并重命名为guestbook.php

  2.在guestbook最顶部添加如下代码(用于模板调用)

  《?php

  /*

  Template Name: Guestbook

  */

  ?》

  3.进入博客管理后台,点撰写页面,在“页面模板”处选择第二步弄好的“Guestbook”,发表一个页面,然后打开这个页面并记录页面链接地址(第9步要用)

  4.优化guestbook.php把日志发表时间、标签什么的删掉

  (备注:我们应用的主题不同,查找类似的关键字选择性删除)

  日志发表时间:

  Posted in《?phpthe_category(‘, ’)?》on《?phpthe_time(‘m/d/Yh:ia’)?》by《?phpthe_author()?》

  标签:

  《ulclass=“post_tags”》《liclass=“tags”》

  《?phpthe_tags(‘Tags:’, ‘, ’, ‘’);?》 

  《/li》《/ul》

  5.替换guestbook.php中的如下代码,使其调用新的评论页

  《?phpcomments_template();?》

  替换成

  《?phpcomments_template(‘/guestcomments.php’);?》

  6.找到模板目录中的comment.php文件,复制comment.php并重命名为guestcomments.php

  7.优化guestcomments.php把“评论”都改成“留言”

  8.更改留言的显示顺序,让最新发布的留言位于最上边。替换guestcomments.php的如下代码

  foreach($commentsas$comment)

  替换成

  foreach(array_reverse($comments)as$comment)

  9.更改侧栏wp-includeswidgets.php,在里边加上“留言”的链接(非必要步骤,可省略)

  《?phpecho$before_widget;?》

  《?phpecho$before_title.$title.$after_title;?》

  《ul》

  《?phpwp_register();?》

  《li》《?phpwp_loginout();?》《/li》

  《li》《a href=“/?page_id=2675”》留言《/a》《/li》

  《li》《a href=“《?phpbloginfo(‘rss2_url’);?》” title=“《?phpechoattribute_escape(__(‘Syndicate this site using RSS 2.0’));?》”》《?php_e(‘Entries 《abbr title=“Really Simple Syndication”》RSS《/abbr》’);?》《/a》《/li》

  《li》《a href=“《?phpbloginfo(‘comments_rss2_url’);?》” title=“《?phpechoattribute_escape(__(‘The latest comments to all posts in RSS’));?》”》《?php_e(‘Comments 《abbr title=“Really Simple Syndication”》RSS《/abbr》’);?》《/a》《/li》

  《?phpwp_meta();?》

  《/ul》

  《?phpecho$after_widget;?》

  备注:本步骤如果出现乱码的情况,解决方法如下

  A.用dreamweaver打开widgets.php

  B.修改-页面属性-标题/编码

  C.编码-Unicode (UTF-8)-重新载入