Support » Plugin: WP ULike » Sort Comments by most likes

  • Divvy

    (@divvy)


    Hello,

    Is it possible to display the comments with the most likes on top?
    Exactly like youtube have for example…

    Would be a great feature! 🙂

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Alimir

    (@alimir)

    Hi @divvy

    You can try the following filter: (But keep in mind that this filter will not display non-liked comments)

    add_filter( 'comments_template_query_args', function( $comment_args )
    {
        // Our modifications
    	$comment_args['meta_key'] = '_commentliked';
        $comment_args['orderby'] = 'meta_value';           
        $comment_args['order']   = 'DESC';
    
        return $comment_args;
    } );
    Divvy

    (@divvy)

    Hey @alimir,

    Thank you bud. Worked perfectly 🙂

    Too bad that doesn’t display non-liked comments like you said.
    Is it difficult to display non-liked comments too? Or not possible?

    Maybe someone can help with this filter of yours, since there is many people looking for the same feature.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.