You need to get the post ids of the top 20 most liked posts. You can query our like table to find out the sum of likes of each post group by post id and sorted by the sum of like count. You can refer to most liked posts shortcode. Once you have the list of post ids, you can check for the current post’s id with the array of most liked post ids by using in_array function. If that function returns true, then that specific post is in the top 20.