WordPress | wordpress留言板的制作

转载自:http://uicss.cn/wordpress-guestbook/

要因自己的主题而定,也可以使用其他*.php比如page.php也可以
文字背景为黄色 是我没有操作的,因为我的主题没有那个东东参数,添加后会报错~
灰色背景是自己修改的地方,自己看着修改就行

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

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

<?php
/*
Template Name: Guestbook
*/
?>

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

4.优化guestbook.php把日志发表时间、标签什么的删掉
(备注:我们应用的主题不同,查找类似的关键字选择性删除)

日志发表时间:
Posted in <?php the_category(‘, ‘) ?> on <?php the_time(‘m/d/Y h:i a’) ?>by <?php the_author() ?>
标签:
<ul class="post_tags"><li class="tags">
<?php the_tags(‘Tags: ‘, ‘, ‘, ”); ?>&nbsp;
</li></ul>

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

<?php comments_template(); ?>
替换成
<?php comments_template(‘/guestcomments.php’); ?>

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

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

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

foreach ($comments as $comment)
替换成
foreach (array_reverse($comments) as $comment)

这部我没有做,我的模版里没有这个参数

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

  1. <?php echo $before_widget; ?>
  2. <?php echo $before_title . $title . $after_title; ?>
  3.     <ul>
  4. <?php wp_register(); ?>
  5.     <li><?php wp_loginout(); ?></li>
  6.     <li><a href="/?page_id=2675">留言</a></li>
  7.     <li><a href="<?php bloginfo(‘rss2_url’); ?>" title="<?php echoattribute_escape(__(‘Syndicate this site using RSS 2.0’)); ?>"><?php_e(‘Entries <abbr title="Really Simple Syndication">RSS</abbr>’); ?></a></li>
  8.     <li><a href="<?php bloginfo(‘comments_rss2_url’); ?>" title="<?php echoattribute_escape(__(‘The latest comments to all posts in RSS’)); ?>"><?php_e(‘Comments <abbr title="Really Simple Syndication">RSS</abbr>’); ?></a></li>
  9. <?php wp_meta(); ?>
  10.     </ul>
  11. <?php echo $after_widget; ?>

备注:本步骤如果出现乱码的情况,解决方法如下
A.用dreamweaver打开widgets.php
B.修改-页面属性-标题/编码
C.编码-Unicode (UTF-8)-重新载入

- THE END -
版权声明:
转载原创文章请注明,文章出处://kinggoo.com
原文地址:https://kinggoo.com/xtyy-wp-makeguestbook.htm
发表评论?

23 条评论。

  1. I really wanted to send a small word to say thanks to you for the fantastic points you are writing on kinggoo.com. My time-consuming internet lookup has at the end been honored with extremely good ideas to exchange with my pals. I ‘d express that many of us site visitors actually are extremely endowed to exist in a notable community with so many lovely individuals with useful points. I feel really fortunate to have used your webpage and look forward to so many more fun moments reading here. Thanks a lot again for a lot of things.

  2. 这是一个灵感亲自揭开更涉及到这个问题的出路。我必须承认,你的数据延长了我的想法,以及我会适当现在你的饲料,以保持每个未来的weblog职位,你大概会创建日期。你是值得感谢完美地完成了工作!

  3. 感谢您抽出时间来辩论,我真的强烈感觉到它的爱关于这一主题的额外学习。如果实现,为您实现专业知识,你会介意额外的数据更新您的博客?这是对我来说非常有帮助。

  4. My companion and I actually enjoyed studying this weblog submit, I used to be just itching to know do you commerce featured posts? I’m always trying to find somebody to make trades with and merely thought I might ask.

  5. Σας ευχαριστώ, καλή δουλειά! Αυτή ήταν η ουσία θα έπρεπε να κάνω.

  6. It’s so hard to get backlinks these days, honestly i need a backlink by comments on your blog / forums or guestbook to make my website appear in search engine. I am getting desperate Now! I know you’ll laugh while reading this comment !!! Here is my website penis enlargement I know my comments do not relate to the topic, but PLEASE HELP ME!! APPROVING MY COMMENT!
    Regards: PoormanBH2011

  7. It’s so hard to get backlinks these days, honestly i need a backlink by comments on your blog / forums or guestbook to make my website appear in search engine. I am getting desperate Now! I know you’ll laugh while reading this comment !!! Here is my website penis enlargement I know my comments do not relate to the topic, but PLEASE HELP ME!! APPROVING MY COMMENT!
    Regards: PoormanBH2011

  8. Greatings,
    la frase Brillante
    Ivan

  9. 其实就是增加一个单独做评论

  10. 我来测试一下乱码邮件回复后乱码的问题~

发表评论


此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据