June 9th, 2006

How to Create a WordPress Guestbook Reloaded

written by Andrew

I’ve gotten emails from people griping that my previous post about making a guestbook for their WordPress blogs does not work for them. I’m making up for that lame post right now!

Ok, I am writing this post under the assumption that:

  • You have FTP access to your web server containing your WordPress installation.
  • You have admin access to the blog you’re making a guestbook for.
  • You know basic HTML editing.
  • You can tell the difference between regular text, HTML and PHP variables.

1. The very first thing to do is open up your theme folder saved in your computer. Look for the file named “single.php”.

single-php-select

2. Copy (Ctrl-C) the file and Paste it (Ctrl-V). The file will automatically be named “Copy of single.php”. Rename the file to “guestbook.php”.

change-file-name

3. Open up guestbook.php in your favorite text editor (e.g. Notepad, UltraEdit).

On top of the file, right before:


<?php get_header(); ?>

Add:


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

Save the file (Ctrl-S). What we just did is create a separate template for your guestbook, which we will use when we create the new page. Customize other portions of the file as needed.

4. Open up your FTP program. Change directory to your current theme folder.

Ex. blogdomain.com/wp-content/themes/theme_name/

5. Upload guestbook.php.

6. Access your Wordress admin panel to Write > Page to create a new page.

write page

Type “Guestbook” as the page title. Compose a brief introduction for the page content.

Ex. Please Sign My Guestbook!

7. On the right-hand side, pick Guestbook as the page template.

pick template

8. Save the page. If you don’t want your guestbook to display the post date, browse to Presentation > Theme Editor > guestbook.php

Look for:


<?php the_time('Y/m/d') ?>

And delete it. Click Update File to save.

9. If you want to change the way the guestbook entries and the input form appear, here’s how. Copy comments.php and save it as ‘guestcomments.php’. Edit the file to your liking. Some samples:

Change the comment heading “X comments” to “X guestbook entries”
Change the submit button text “Post Comment” to “Sign Guestbook” or “Sign It!”
Change “Your comment is awaiting moderation” to “Your guestbook entry is awaiting moderation”

Text may differ from to template to template, so look for approximate matches in your files.

To reverse the order of comments, look for:

foreach ($comments as $comment)

and replace with:

foreach (array_reverse($comments) as $comment)

Upload guestcomments.php to the current theme folder on the server.

10. Once again, open up guestbook.php in the Theme Editor. Scroll below and change the line:

<?php comments_template(); ?>

to

<?php comments_template('/guestcomments.php'); ?>

Voila! You now have a guestbook!

I tried my best to make these instructions as painless as possible. If you’re still having issues, please don’t hesitate to leave me a note. Enjoy your new guestbook.

If you ‘dugg’ this article, click here to digg it!

Update: WordPress Generator Plugin is a sparkly new plugin that does all the dirty work for you!

Bookmark at: StumbleUpon | Digg | Del.icio.us | Twitter | Facebook

Posted in Blogging, Tip of the Week, Wordpress


  1. 52 Comments

  2. name said...

    Nice site! Color scheme no bad… Add spam protect and be happy ! Happy code =619

    Jun 13, 2006

  3. Jan said...

    ei! can you help me as to how to customize the guestbook page above to display another word instead of the word “Comment >>” and change the title of the submit button from “Submit comment” to any other name? please? Thanks in advance!

    Jun 17, 2006

  4. Andrew said...

    Hi Jan, check out the updated instructions to achieve what you wanted. :)

    Jun 18, 2006

  5. jan said...

    Thanks andrew! I think I missed out on that part of the instructions..ü

    Jun 19, 2006

  6. Andrew said...

    Np Jan! That part was added recently because of your request. :)

    Jun 20, 2006

  7. me said...

    thx for the instructions :)

    Jul 5, 2006

  8. Robin said...

    Omg, this wast exactly what I was looking for, thanks a lot!

    Aug 8, 2006

  9. dato said...

    sdadasdasdasdas

    Sep 27, 2006

  10. albert said...

    The guestbook generator plugin doesn’t work for my almost spring theme,so I have to follow these structions to create a guestbook,I wonder if I want the comments arranged from newest to oldest,how should I do?

    Oct 19, 2006

  11. albert said...

    Andrew,thanks very much,I followed the step and the problem is solved.

    Oct 20, 2006

  12. phitsanulok said...

    I have been reading your guest book from the beginning, page or two a day. Often I have the energy to read and enjoy, but not write (it is difficult to explain emotions). I like the comments in different languages, even though I can read English well, and Spanish a little, and can just understand some of the words in Italian and Japanese.
    ————— http://www.phitsanulok.go.th/ngclink/index.html —————–

    Oct 27, 2006

  13. Fannie said...

    I got it work! Thank you very much!

    Oct 28, 2006

  14. Mike said...

    looked very nice, but i think my theme doesn´t support the generator. :(

    it says:
    “The required template files were not found in your current theme. Guestbook cannot be generated.”

    thnx anyway, mate
    greetz mike

    Nov 9, 2006

  15. C said...

    Running from default theme: you can apparently switch off the plugins after creating the guestbook. Running the plugin again will create a new page.

    Nov 22, 2006

  16. Y said...

    Hi I tried to generate the guestbook but I got the following message
    “The required template files were not found in your current theme. Guestbook cannot be generated.”
    I wanted to copy single.php as you instructed but I can’t find it. I am using the theme “Sky3c by Kaushal Sheth” and wordpress 2.0.4
    Any ideas?
    Thanks
    Y

    Dec 6, 2006

  17. Y said...

    I finally realized I could copy the index.php and then rename it, this solved the problem :)
    However the guest book page has “Please sign my Guestbook. Thanks!”, with no link so I don’t understand how to post a comment. I think my initial theme was modified to remove the comments… any ideas ?
    thanks Y

    Dec 6, 2006

  18. Michiel said...

    It also said that I was missing the “single.php” file, but Y’s solution worked just fine. I was just wondering if it’s possible to remove the numbering of the comments/entries. Or to turn them around, so that the latest entry get’s the highest entry-number.

    Jan 10, 2007

  19. peter said...

    Feed for this Entry did not work in the newest k2 revision 291

    Mar 20, 2007

  20. Marcel van Leeuwen said...

    Hello Andrew,

    I have followed the instructions on your site, but my comments aren’t displayed. I lookerd everywhere but can’t find what’s wrong. Could you please have a look at my site and tell me what to do? You have to click at “Alle reacties”, that’s the page I added.

    Thanks for your help.

    Kind regards,
    Marcel

    Mar 24, 2007

  21. vane said...

    Hello!

    Does not exist a way to allow the amount of signatures of guestbook when visualized the page of guestbook? Thanks!

    Apr 29, 2007

  22. Ricard said...

    Hi!

    When they wrote a comment to my guestbook, and sign the required mail and name. it comes back with error that says it was a wrong email-adress. i can’t figure out why?

    May 24, 2007

  23. funsin said...

    can you help me as to how to customize the guestbook page above to display another word instead of the word “Comment >>” and change the title of the submit button from “Submit comment” to any other name? please? Thanks in advance! help~!

    Jul 24, 2007

  24. jeela said...

    Overall this has been great, since the Guestbook Generator plugin did not work for my theme. But I’m also stumped at changing the text that says things like “Leave a Reply” and the Submit Button… the file looks to have the text I want but doesnt display??

    here is my guestbook, thanks to you!
    http://www.jeelago.net/work/guestbook/

    Sep 3, 2007

  25. parabat said...

    I have received this error. Any help will be greatly appreciated.

    “Fatal error: Call to a member function on a non-object in …./guestcomments.php on line 51″

    Oct 5, 2007

  26. James Bliss said...

    Hi Andrew, great instructions, thanks.

    I’m not (yet) using this on my public blog but I am on a non-public blog I author and it works really well.

    Feb 12, 2008

  27. Jomarie said...

    Ahm… is there any codes for registration for the viewers together with their comments?

    Jul 14, 2008

  28. Hans said...

    Great guestbook, thxs!
    very easy, but i have one question. I don’t want the comments to be approved by the moderator, but they have to be approved automaticly, so they appear at the same time on my website. Without any controle. How can create that? please help :)

    Jul 25, 2008

  29. miner said...

    Hey, is it possible that you can help me with my Guestbook? It’s not working for me!

    Please contact me by e-mail.

    Thanks :D

    Jan 31, 2009

  30. mixor said...

    Well it doesn’t work for me… When I open comments.php there is only this text:

    How can I change this to how I want it?

    Feb 4, 2009

  31. Bianca said...

    With that simple tutorial make is so easy for us to make. Thanks for the instructions.

    Feb 16, 2009

  32. Erick S. said...

    Brilliant!

    This way you have total control over how it will look in the end…I really like this tutorial!

    Jun 17, 2009

  33. Dax said...

    Hi there,
    I use your guest book plug-in and is working fine. The only problem is pagination. On my guest book, comments are approaching 150+, i want it to be like 20 0r 25 per page. How to do it ? Your input is much appreciated.
    url: http://www.mitixa.com/guestbook

    Jan 2, 2010

  34. SuperTiti said...

    Hi Everybody there,

    Some template have a “page.php” file along with a “single.php”. So if Guestbook Reloaded seems to not work with your template, search for “page.php” in your template folder and apply same modifications. I mean you should duplicate “page.php” instead of “single.php” and It should work perfect.
    (WordPress 2.9.1, ok !)

    Jan 16, 2010

  35. SuperTiti said...

    I just forgot to say :

    Thanks Andrew for this tuto !
    :-D

    Jan 16, 2010

  36. Sushil Gupta said...

    Hi there, thanks for the code and all the instruction. I am now using guestbook. But I have got a problem, the page doesn’t breaks automatically or what I mean to say is, all the comments are on the same page instead of breaking up! How can I do so, I mean I want latest 5 0r 10 comments on the first and then older on the secondary page.. I am not able to configure it out. Please help me.
    Thank you.

    Feb 20, 2010

  37. Mihir Lakhani said...

    dude ! this is a good way of making simple guestbook in WP. may be location could make it much better, but still this is awesome.

    thank you

    Mihir

    Aug 30, 2010


  1. 16 Trackbacks

  2. Skullcrusher | org » Wordpress’e Ziyaretçi Defteri Nasıl Eklenir ?

    Jul 1, 2006

  3. Chagel’s weblog » WordPress installation, configuration and other Tips

    Sep 18, 2006

  4.   WordPress Plugin: Guestbook Generator by Blogging Pro

    Sep 24, 2006

  5. WordPress Guestbook

    Feb 7, 2008

  6. 简单5步,制作wordpress留言板–舶来文 | 流浪五天

    Apr 13, 2008

  7. Sergejpinka » Come creare un guestbook per Wordpress

    Apr 20, 2008

  8. 制作wordpress留言板 - groveboy

    Apr 26, 2008

  9. ŞEHRİDERYA » Blog Archive » Wordpress’e Ziyaretçi Defteri Ekleyelim

    Jul 6, 2008

  10. Guestbook - angelsky11

    Dec 11, 2008

  11. 简单5步,制作wordpress留言板 - 【奥林达】

    Feb 9, 2009

  12. Z R Free » Create a Wordpress Guestbook

    Feb 25, 2009

  13. 子猴空间 » Blog Archive » 简单5步,制作wordpress留言板

    Mar 15, 2009

  14. 爬行者 » 新建”留言薄”页面

    Jun 19, 2009

  15. WordPress留言板 » Lemuria

    Oct 9, 2009

  16. Come creare un guestbook per Wordpress | Sergejpinka

    Nov 8, 2009

  17. 夜泊枫桥 » wordpress留言板制作

    Jan 19, 2010

Post a Comment