“WordPress Threaded Comment Numbering Plugin Updated” Comments, Page 1

avatar image

You are currently browsing page 1 of comments on the article WordPress Threaded Comment Numbering Plugin Updated.

More on WordPress plugins

Greg’s WordPress plugins available at CounsellingResource.com can help you to:

Would you like to reach the community of bloggers using particular plugins? Check out the Sustainable Plugins Sponsorship Network.

You are currently browsing comments. If you would like to return to the full story, you can read the full entry here: “Greg’s Threaded Comment Numbering Plugin for WordPress Updated to Version 1.2”.

27 Responses (Including 11 Discussion Threads) to “WordPress Threaded Comment Numbering Plugin Updated”

  1. avatar image
    Nikolay
    1

    First, thank you for the plugin!

    Second, I have found a bug in version 1.2: you put closing bracket in incorrect place. See file gtcn-options-functions.php, function do_options(…), lines 223-224:

    $header = wptexturize(__($settings['header'][$stepper]), $domain);
    $preface = wptexturize(__($settings['preface'][$stepper]), $domain);

    The __(text, domain) function has to have two parameters! But in your code, it has only one parameter. It looks, you place a first closing bracket in incorrect place. The code above has to look like this:

    $header = wptexturize(__($settings['header'][$stepper], $domain));
    $preface = wptexturize(__($settings['preface'][$stepper], $domain));

    Hope, it will help making the pluging better! :)


    • 1.1

      @Nikolay — Yep, you’re right, and thank you for spotting it! That was a silly typo. I’ll push out an update for all three of the plugins shortly. Stay tuned…

      All the best,
      Greg


  2. avatar image
    Perdox
    2

    Thanks for a great plugin. I love it!

    I am new at this so I followed your instructions very carefully. You state on the instructions page

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

    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 :)

    So I only replaced the first one. Now my numbers start at 1. Is this OK? Do I have to do the other 2? This won’t cause problems later?

    Thanks again for a great plugin.


    • 2.1

      @Perdox — 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.

      All the best,
      Greg


  3. avatar image
    Perdox
    3

    Sorry, forgot to click on the notify me button.


  4. avatar image
    Blimey
    4

    Thanks for the great plugin. I wasn’t sure how to handle numbering threaded comments and I really like how you do it. One thing I noticed however is that the div for the reply button is printed no matter if a reply is allowed or not. For a lot of themes this probably isn’t a problem but in my theme the reply button is styled using the parent div. I allow a depth of just 4 due to the narrow width of my content pane and while the reply buttons looked great for depths 1 through 3, beneath 4 where there should be no button at all, was a button with no text or link. This looked quite bizarre.

    To resolve this I added a check around the div where it only shows the button if depth is less than max depth. It’s now fixed for my setup but I’m sure others will have this same issue.

    One other thing, could you please add a class to the comment div on line 208? I need to add a bit of spacing to this div but the id has comment info appended to it so I wasn’t sure how to hit it with css. My workaround was to simply throw a style tag on it and call it good.

    I’d like to be able to upgrade when you release an update without having to go in and modify the code again and I think both of these things affect more than just myself.

    Thanks again!
    Blimey


    • 4.1

      Hi Blimey,

      I’m glad to hear the plugin is doing the job for you. :-)

      Each of the issues you’ve described comes not from the plugin code itself, but rather from the default callback function — copied directly from the WordPress Codex and bundled with the plugin — which users can copy as a starting point for creating their own callback functions. If you’d like to modify that callback function, the best way to go about it is not to alter the version bundled with the plugin file, but rather to copy that callback function into your own theme’s functions.php file, name it something else, and then reference that callback function — rather than the default bundled one — from within your theme. Once it’s safely there in your theme’s functions.php file, you can chop and change to your heart’s content, and both it and the plugin can be updated entirely independently.

      All the best,
      Greg


  5. avatar image
    draguscn
    5

    Thanks for good plugin ..
    I just migrated from Intense debate .. my question are
    1. how do style stuff like you do here?
    2. some of my old comments is not right placed as answers of another comments.. such as the number for that comments must be 23, 24, 25 and on .. instead the number are 22.1, 22.2, 22.3 and on ..


    • 5.1

      @draguscn,

      With regard to styling stuff as you see here, we use a custom template developed in house.

      With regard to some of your older comments not being placed correct as replies to other comments, please note that as of version 2.7.1, WordPress has some serious problems with comment ordering when nesting levels are changed or parent comments are deleted. If you’re seeing comments apparently displayed in the wrong order, this is a very likely explanation.

      All the best,
      Greg


  6. avatar image
    Griff Wigley
    6

    Greg,

    I’ve turned on IntenseDebate for my blog. So far so good, but I can’t get your comment numbering to show.

    Are the two incompatible?


    • 6.1

      Hi Griff,
      Although technically compatible with WordPress 2.7, it appears that the IntenseDebate plugin forcibly changes the display of your comments to use the old pre-2.7 method, even if your theme explicitly calls the new comment loop method available in 2.7 and later. This means that all plugins and themes which rely on the new-style comment loop will encounter problems.
      It would be helpful if the Automattic folks would update the plugin to catch up with capabilities users may wish to take advantage of in the current version of WordPress.
      All the best,
      Greg


  7. avatar image
    Griff Wigley
    7

    Thanks, Greg. I’ll contact ID support to see what they say.


  8. avatar image
    Whoppy
    8

    Hello Greg,
    thanks for your great plugin. I’ve one problem, I changed the order of my comments with ‘reverse_top_level’=>DESC. For example, if I have 23 comments orderd DESC, the plugin counts from 23 to 45. Is there a possibility to count from 23 to 1?
    With best regards, Whoppy.


    • 8.1

      Hi Whoppy,
      The plugin respects whatever ordering has been specified using the standard WordPress option (set via the Admin panel, Settings Discussion subpanel) for whether to reverse the order. This setting determines the default ordering produced by the standard WordPress comments loop in 2.7 and later:

      http://codex.wordpress.org/Template_Tags/wp_list_comments

      If you patch in separate changes to how comments should be ordered (e.g., by setting the parameter directly from your comments template file), the plugin won’t know about it.

      So, if you are manually altering the ordering directly rather than via the standard WordPress option intended for that purpose, you’ll likely encounter problems both with the plugin and with any other built-in functionality that tests the value of that option. How to get around that problem? Just remove your ‘behind the scenes’ alteration to the ordering and use WordPress’s admin page to set it instead.

      I hope that helps!

      All the best,
      Greg


  9. avatar image
    Whoppy
    9

    Not really, because I need both variants on my blog, ASC and DESC order. But thanks for your quick reply.


    • 9.1

      Hi Whoppy,

      Actually, I may have to set aside some time to have a closer look at this. It turns out there’s a bug in WordPress (reported 5 months ago but still not scheduled to be fixed as of 2.8) which gums up the works a bit when theme calls override the value of reverse_top_level specified in the admin panel, and I believe this is rendering unreliable some of the values returned by other WordPress functions that the plugin uses:

      http://core.trac.wordpress.org/ticket/8755

      I’m not sure at this point whether this can be worked around straightforwardly; the new WordPress comment code is a bag of hurt, and at some point it becomes preferable just to wait for the core code to be fixed rather than continually trying to produce work-arounds for obscure core bugs.

      We’ll see…!

      All the best,
      Greg


    • 9.2

      Hi Whoppy,
      Silly me!
      It turns out that setting reverse_top_level to DESC is not the correct way to set your comment order — you might have noticed that the order of your comments was not actually changing?
      The accepted values for reverse_top_level are 1 and 0 (or null). It’s easy to get confused by this, since the option called ‘comment_order’ takes values of asc and desc — but those get converted into TRUE and FALSE inside wp_list_comments. (However, those two Boolean values don’t actually work correctly if you pass them in as arguments; only a value of 1 will make the flip happen.)
      Anyway, if you use the correct method for setting reverse_top_level, the plugin will behave as you expect.
      All the best,
      Greg


  10. avatar image
    Whoppy
    10

    Hi Greg,
    you are the best. With reserve_top_level set to 1 it works perfect. The funny thing is that the comment order also had changened with reserve_top_level set to true, but not the numbering.
    Anyway, thanks for your help, have a nice day.
    Best regards, Whoppy.


Page 1 of 212»

Join the Discussion!

We support Gravatars rated PG or G; if you don't have a Gravatar, we'll display a mathematically created identicon next to your comment.

A valid email address is required to enable you to personally verify and authorize your comment for posting. It will not be displayed in your post or used in any other way. SPAM comments will be deleted, as will those attempting to circumvent the Gravatar rating system or attempting to circumvent our Terms of Use by employing Gravatar images to advertise on this site.

 characters available

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting