Home Forums WTI Like Post PRO Display current post position

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #383
    carlos
    Participant

    Hi,

    I want to know if is there a way to display the current post position. My site will be about regional music bands, in the sidebar I show info about the current band, name, genre, contact, etc., I would like to display a highlighted message like “this band is in the top 20”.

    In the template you named “most-liked-posts.php” even in wti-like-post-widgets.php, I think there’s a code that can help me, but how I can compare the current post ID (wordpress function) with the post ID you store in the plugin’s DB table?, I think that using a simple counter I can compare both IDs, print that counter when they are the same and break de loop. My knowledge about PHP/MySQL is limited.

    Thank you!

    Carlos

    #384
    Webtechideas
    Keymaster

    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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘WTI Like Post PRO’ is closed to new topics and replies.