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 entriesThe 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'; ?>
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 »', '1 Comment »', '% Comments »'); ?>
Replace it with:
<?php
$tb_article_url = "/path to WordPress/?p=$id";
$tb_permalink = get_permalink();
tbtbget_commentsLink('No Comments »', '1 Comment »', '% Comments »', '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. » 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'; ?>
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
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.