• Resolved ryanmvickerman

    (@ryanmvickerman)


    Hello! I’m trying to sort my posts using the ULike voting data using a query loop in Bricks Builder but, I can’t seem to find a meta key that I can sort with.

    Database table “ulikemeta” with the meta key “count_total_like” in which, there is a column called “item_id” where the post_id is referenced and a column called “meta_group” where value is indicated as “post”.

    I’m stumped…any pointers? I’d like to make sure this works before getting the Pro version if possible. I’d appreciate any help you can offer. Thanks!

    The page I need help with: [log in to see the link]

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

    (@alimir)

    Hey @ryanmvickerman

    You can try sorting your posts using the free version by utilizing the wp_ulike_get_popular_items_ids function. Here’s how it works:

      The function returns an array of post IDs, which you can then pass to your query arguments as follows:

      $post__in = wp_ulike_get_popular_items_ids(array(
      'type' => 'post', // Set the type to 'post'
      'rel_type' => 'post', // Set the related post type
      'status' => array('like'), // Use both like and dislike status
      'period' => 'all', // Set the period to 'all' or other timeframe
      "offset" => 1, // Offset for pagination, start from 1
      "limit" => 10 // Limit the number of posts retrieved
      ));

      $args = array(
      'post__in' => $post__in, // Use the retrieved popular item IDs
      'orderby' => 'post__in', // Keeps the order based on popular IDs
      'posts_per_page' => 10 // Adjust the number of posts per page as needed
      );

      his should allow you to sort your posts based on ULike voting data inside your custom query.

      But If you decide to get the Pro version, you’ll gain access to the standard WordPress meta fields like like_amount, dislike_amount, and net_votes, making sorting even more flexible.

      Thread Starter ryanmvickerman

      (@ryanmvickerman)

      @alimir …thank you so much for setting me on the right path! I can’t seem to find the hook for when the user votes. Would you mind sharing the hook?

      Plugin Author Alimir

      (@alimir)

      Thread Starter ryanmvickerman

      (@ryanmvickerman)

      @alimir …thank you!

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