Numbered comments

  • Author
    Posts
  • #6565
    Elfew

    Hi,

    I use your mantra theme.

    I would like to use this plugin http://wordpress.org/extend/plugins/gregs-threaded-comment-numbering/

    I installed it, set everything but I cannot make it work – same problem – I cannot find the proper line in comments.php

     

    Basic Usage

    So, having said all that, what’s the fastest (and least flexible) way to get your comments numbered?

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

    Please note that if you decide to use the basic callback function included with the plugin, and you are using anything other than the default theme, the styling of your comments almost certainly will change as a result. Why? Because taking advantage of all the new comment features introduced in WordPress 2.7 requires the use of a callback function (have you heard this before?), and replacing the one you have with the bundledbasic callback function — or adding one where there wasn’t one before — means replacing whatever existing structure and style you already have in place. If you’re using the WordPress default theme, the two will coincide, so you won’t see any difference — but with other themes employing their own structure, they will not.

    This fact is 1) unavoidable and 2) straightforward to overcome. It is unavoidable because this is how WordPress handles comments as of version 2.7 and later. It is straightforward to overcome because anyone can create their own callback function, as detailed under ‚Advanced Usage’.

    Please do not contact me to report that using the basic callback function has changed the styling of your blog’s comments!

    Advanced Usage

    And what’s the more involved (but far more flexible) way to get your comments numbered?

    Create your own callback function to display comments how you would like them (by modifying the callback function already included in your theme or, if your theme doesn’t have one, by using the included basic callback function as a starting point), and insert gtcn_comment_numbering($comment->comment_ID, $args) within the callback function wherever you would like the comment number to appear. For custom styling, the function can also take an optional third parameter which defines the class of the div used to wrap the comment number. The default class is commentnumber. (If you’d rather not have any div wrapper placed around the comment number, you can specify this in the main plugin settings.) Finally, a fourth optional parameter enables you to suppress automatic output of the comment number by passing in ‚quiet’. By default, the comment number will be echoed rather than returned.

    So, for example, to retrieve the comment number rather than triggering its output, you might use:

    $comment_number = gtcn_comment_numbering($comment->comment_ID, $args, $wrapclass, 'quiet')

    The usual place to store your own callback function is in your theme’s functions.php file. Just give the function a unique name, and reference it — rather than the included basic callback function — when your theme calls wp_list_comments(), like so:

    wp_list_comments('callback=my_uniquely_named_callback_function')

    thank you for our help!

     

    • This topic was modified 11 years ago by Zed. Reason: fixed formatting
    • This topic was modified 10 years ago by Zed.
Viewing 1 post (of 1 total)

The topic ‘Numbered comments’ is closed to new replies.