• in my comments.php there is only COMMENT_ID (),
    I tried “echo get_comment_id()”

    but does not work

    I just want the right order of the comments.
    how do you?

Viewing 15 replies - 1 through 15 (of 18 total)
  • Where did you download this theme from?

    Thread Starter morpe

    (@morpe)

    has not been downloaded, it is my theme I’m working on.
    I do not understand in what context should be used

    So where did you get the COMMENT_ID() function from? That’s not a template tag or core WordPress function.

    Thread Starter morpe

    (@morpe)

    Have you read that page? That function just display the id of the current comment. Have a look at comments.php in Twenty Eleven for an example of what you should be using.

    Thread Starter morpe

    (@morpe)

    hi!
    I tried it, Twenty Eleven uses wp_list_comments, would be fine, we would pass a function to get the ID in the right order (including reply), but then print in the page div or ul/ol
    I do not need.

    I only need the ID of the comments in the right order, I will not print anything.
     
    I’m trying to write a function to sort the comments, but it’s like re-inventing the wheel, WP already makes this

    I’d suggest that you start by looking for a suitable plugin and hacking/borrowing from it if necessary.

    Thread Starter morpe

    (@morpe)

    you mean by hacking?
    I edit core_file of wp?
    write a plugin?

    can you give me the instructions, I do not know where to start

    thank you!

    I edit core_file of wp?

    No! Never, ever, edit WordPress core scripts. And do not encourage others to do so. Editing core scripts can bring down your entire site and/or open security holes for hackers to use.

    I meant you could hack the plugin.

    Thread Starter morpe

    (@morpe)

    yes, you’re right, it would be a problem for the next update

    this is my comment.php

    <?php
    
    function fake($comment, $args, $depth)
    {
    	$GLOBALS['comment'] = $comment;
    	$GLOBALS['fake'][] = get_comment_ID();
    }
    
    wp_list_comments('type=comment&callback=fake');
    
    var_dump($GLOBALS['fake']);
    
    ?>

    here is the result in html

    if I use div as an option for style, writes div instead of ul/ol

    Don’t use $GLOBALS in WordPress. What is it that you’re trying to do with that callback function?

    Thread Starter morpe

    (@morpe)

    imagined that Global was not a good idea …

    fake() is the only way I’ve found to get the right order of the comments

    What is the right order?

    Thread Starter morpe

    (@morpe)

    order of comment in $comments
    comment 10
    comment 11
    comment 12 is reply to 10
    comment 13
    comment 14 is reply to 11
    comment 15 is reply to 11
    comment 16 is reply to 14

    right order
    comment 10
    comment 12 is reply to 10
    comment 11
    comment 14 is reply to 11
    comment 16 is reply to 14
    comment 15 is reply to 11
    comment 13

    You don’t need to do anything! WordPress will order the comments by default if you use wp_list_comment() AND you configure WP to display threaded comments in Settings -> Discussion.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘COMMENT_ID() because it does not work?’ is closed to new replies.