Table of Contents

This explains how to use TalkBack for WordPress blogs instead of the built in WordPress comments system. Make a backup copy of each file before changing it.

Head section entries
Adding comments to posts
Transferring existing comments
Why to use or not use TalkBack with WordPress

Head section entries

The head section page is the file that contains the <head> section HTML. In WordPress it is header.php in the theme directory. Find the line containing <?php wp_head(); ?>. Insert this line above it.

<?php include 'relative path to TalkBack/head-inc.php'; ?>

Adding comments to posts

The front page template:

In WordPress it is index.php in the theme directory. Find the code that prints the comments link at the end of each post. In the default WordPress template it looks like this:

<?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?>

Replace it with:

<?php 
   $tb_article_url  = "/path to WordPress/?p=$id";
   $tb_permalink    = get_permalink();
   tbtbget_commentsLink('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;', 'View and leave comments', '');

The first three parameters of tbtbget_commentsLink contain the link text for zero comments, one comment and two or more comments respectively. &#187; causes a » character to be printed. The fourth parameter contains the link title text. The fifth parameter contains a class name if you want to style the link.

The individual page template:

In WordPress the template for the individual page is named single.php in the theme directory. Find the code that invokes printing of the comments template. In The default WordPress theme it looks like this: <?php comments_template(); ?>. Replace it with:

<?php 
   $tb_article_url  = "/path to WordPress/?p=$id";
   $title        = get_the_title();
   include 'relative path to TalkBack/comments.php'; 
?>

Transferring existing comments

  1. Follow the above instructions before copying the comments. Make sure that TalkBack is working with your blog by entering a test comment.
  2. /addons/wp-export.php will copy comments from the WordPress database to the TalkBack database. It does not delete the comments from the WordPress database.

    Edit the configuration entries at the top of the script. Get the database information from the wp-config.php file in the WordPress directory.

    define('DB_NAME', 'name');          // the name of the database
    define('DB_USER', 'name');          // your MySQL username
    define('DB_PASSWORD', 'password');  // your mysql password
    define('DB_HOST', 'localhost');     // your mysql server name
    $table_prefix  = 'wp_';             // the table name prefix
    $wp_path = '/wp/';                  // path to the wordpress directory
    
  3. Delete all spam comments from WordPress. Approve or delete any comments awaiting moderation. Put TalkBack into maintenance mode. Backup the TalkBack database if it has non-wordpress comments in it.
  4. Upload wp-export.php to the TalkBack directory. Browse to it.
  5. When it has finished, check to be sure the comments are appearing correctly in the blog.
  6. Delete wp-export.php from the TalkBack directory.

Why to use or not use TalkBack

There are two reasons I can think of for using TalkBack with WordPress instead of it’s built in comment system: (1) You prefer TalkBack’s comment administration interface. (2) You have static pages as well as blog pages and you want to use only one comment administration system for all pages on your website.

Reasons you may not want to use TalkBack with WordPress: (1) If you delete a WordPress post, it’s comments will remain on file in the TalkBack database unless you also delete them via the TalkBack admin panels.