Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Comments, trackbacks & pings (http://forum.bytesforall.com/forumdisplay.php?f=19)
-   -   [SOLVED] Numbering comments using Greg's Threaded Comment Plugin (http://forum.bytesforall.com/showthread.php?t=1303)

perdox808 Apr 17, 2009 06:21 AM

[SOLVED] Numbering comments using Greg's Threaded Comment Plugin
 
Hi Flynn. I think I have been a bad boy; actually, an idiot.

I wanted to install Greg's Threaded Comment Numbering Plugin from http://counsellingresource.com/featu...for-wordpress/.

The instructions were:

replace wp_list_comments() in your theme’s comments.php file with wp_list_comments('callback=gtcn_basic_callback').

I found three of these instances and changed all three.

When testing, the first comment number was actually 0. So I went back to the original file and only replaced the first instance. This seemed to work as the comment numbering started at 1 and seemed to be working correctly.

Fearing that I might have problems further on, I wrote to the developer. Below is a transcript:

My file had this:

wp_list_comments(array(
‘avatar_size’=>$bfa_ata['avatar_size'],
‘reply_text’=>__(’ · Reply’,'atahualpa’),
‘login_text’=>__(’Log in to Reply’,'atahualpa’),
‘walker’ => new Walker_Comment2,
‘max_depth’ => ”,
’style’ => ‘ul’,
‘callback’ => null,
‘end-callback’ => null,
‘type’ => ‘comment’,
‘page’ => ”,
‘per_page’ => ”,
‘reverse_top_level’ => null,
‘reverse_children’ => ”
))
and now I have _list_comments(’callback=gtcn_basic_callback’) where all the above was. Is this OK?

In my comments.php file, there were 3 instances of the above and I replaced them all only to find that my comment numbers were starting from 0 :)

The developer replied:

Your theme does not use the standard built-in WordPress comment walking class by itself, but rather extends it with some additional custom code. Therefore, I would recommend caution when replacing anything that might result in breaking the custom code extensions.

From a very cursory look, it appears that the theme’s default callback function is contained in the file bfa_comment_walker.php, starting around line 94. You could try modifying it by inserting a direct call to gtcn_comment_numbering, as described in the advanced usage instructions.

Alternatively, you might try giving the name of the basic callback function gtcn_basic_callback in the array which the theme is passing to wp_list_comments, rather than the null which is there now.

My best suggestion, though, would be to contact the author of the theme directly and ask them to support the plugin when the plugin is active. That way, the theme author can integrate the numbering functionality into the theme seamlessly, preserving their own custom modifications to the WordPress core code, without someone else like me coming along and trying to guess what to tweak where in order to work with the modifications — and possibly messing up all their hard work in the process.


Flynn, should I give up on this and go back to my old file (which I saved) or is it OK? I won't have problems in the future because of this change will I?

Thank you.

Flynn Apr 17, 2009 05:59 PM

That's fine to do it that way and I am actually replacing that custom comment walker class with the "Wordpress way" to do this in 3.3.3, see also http://forum.bytesforall.com/showthread.php?t=1009

You can keep what you have now if you have no problems or use this instead to push the text (Log in to Reply...) and options (Avatar size) etc to the plugin's comment template as well

<!-- Do this for every comment -->
<?php if ($bfa_ata['separate_trackbacks'] == "Yes") {
wp_list_comments(array(
'avatar_size'=>$bfa_ata['avatar_size'],
'reply_text'=>__(' &middot; Reply','atahualpa'),
'login_text'=>__('Log in to Reply','atahualpa'),
'callback' => gtcn_basic_callback,
'type' => 'comment',
));
wp_list_comments(array(
'avatar_size'=>$bfa_ata['avatar_size'],
'reply_text'=>__(' &middot; Reply','atahualpa'),
'login_text'=>__('Log in to Reply','atahualpa'),
'callback' => gtcn_basic_callback,
'type' => 'pings',
));
} else {
wp_list_comments(array(
'avatar_size'=>$bfa_ata['avatar_size'],
'reply_text'=>__(' &middot; Reply','atahualpa'),
'login_text'=>__('Log in to Reply','atahualpa'),
'callback' => gtcn_basic_callback,
'type' => 'all',
));
}
?>

Although this separation of comments and trackbacks might not work with the plugin so you might be better off using the short version you have now

perdox808 Apr 20, 2009 02:58 AM

Thanks again Flynn. I think I will take your advice and stick with what I have now. I am happy with the result so no need to push it! :)

aquila423 Oct 1, 2009 03:18 PM

I used what you did, below, and when I went to see the comment page, instead of the comments displaying, this error message came up...

Parse error: syntax error, unexpected '<' in /home/unspoke2/public_html/wp-content/themes/atahualpa/comments.php on line 32

Where did I go wrong?

Any help would be much appreciated :-)

Quote:

Originally Posted by Flynn (Post 5156)
That's fine to do it that way and I am actually replacing that custom comment walker class with the "Wordpress way" to do this in 3.3.3, see also http://forum.bytesforall.com/showthread.php?t=1009

You can keep what you have now if you have no problems or use this instead to push the text (Log in to Reply...) and options (Avatar size) etc to the plugin's comment template as well

<!-- Do this for every comment -->
<?php if ($bfa_ata['separate_trackbacks'] == "Yes") {
wp_list_comments(array(
'avatar_size'=>$bfa_ata['avatar_size'],
'reply_text'=>__(' &middot; Reply','atahualpa'),
'login_text'=>__('Log in to Reply','atahualpa'),
'callback' => gtcn_basic_callback,
'type' => 'comment',
));
wp_list_comments(array(
'avatar_size'=>$bfa_ata['avatar_size'],
'reply_text'=>__(' &middot; Reply','atahualpa'),
'login_text'=>__('Log in to Reply','atahualpa'),
'callback' => gtcn_basic_callback,
'type' => 'pings',
));
} else {
wp_list_comments(array(
'avatar_size'=>$bfa_ata['avatar_size'],
'reply_text'=>__(' &middot; Reply','atahualpa'),
'login_text'=>__('Log in to Reply','atahualpa'),
'callback' => gtcn_basic_callback,
'type' => 'all',
));
}
?>

Although this separation of comments and trackbacks might not work with the plugin so you might be better off using the short version you have now


juggledad Oct 1, 2009 04:05 PM

please post the 10 lines before and after line 32 of comment.php nd indicate what line is #32 and I'll take a look

Make sure you do a cut and paset right from teh code and past it into the post betweeh the HTML shortcode's (see the button - second row, second from teh end)

griffinjay Dec 6, 2009 06:01 AM

juggledad/Flynn,

I'm also trying to use Version 1.3.1 of Greg's Threaded Comment Numbering plugin but am stuck on how to deploy it with Atahualpa 3.4.4.

I've read his section "Advanced Usage: Calling WordPress Plugin Functions Directly" at:
http://counsellingresource.com/featu...for-wordpress/

but I'm still confused. Do I make modifications to both the comments.php file and the functions.php file? Others?

I've spent a couple hours trying stuff to no avail so a short step-by-step would be much appreciated!

juggledad Dec 6, 2009 10:01 AM

All you do is edit comments.php and change lines 36, 44 and 54 in version 3.4.4 ( lines 42, 50 and 60 in version 3.4.9) from
HTML Code:

                        'callback' => bfa_comments,
to
HTML Code:

                        'callback' => gtcn_basic_callback,

griffinjay Dec 6, 2009 10:16 AM

Splendid! Thanks so much, that worked perfertly.


All times are GMT -6. The time now is 12:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.