Viewing 2 replies - 1 through 2 (of 2 total)
  • JordanC26

    (@jordanc26)

    You’ll need to modify the query which is being used on your archive page, here is the docs:

    https://github.com/Alimir/wp-ulike#how-to-sort-most-liked-posts

    Plugin Author Alimir

    (@alimir)

    @jordanc26 @olessons We’ve an elementor widget for this purpose in our PRO version.
    But in any case there is a coding solution too. Check the following function in V4.0.0:

    	/**
    	 * Get most liked posts in query
    	 *
    	 * @param integer $numberposts
    	 * @param string $post_type
    	 * @param string $method
    	 * @param string $period
    	 * @param string $status
    	 * @return WP_Post[]|int[] Array of post objects or post IDs.
    	 */
    	function wp_ulike_get_most_liked_posts( $numberposts = 10, $post_type = '', $method = '', $period = 'all', $status = 'like' ){
    		$post__in = wp_ulike_get_popular_items_ids(array(
    			'type'   => $method,
    			'status' => $status,
    			'period' => $period
    		));
    		if( empty( $post__in ) ){
    			return false;
    		}
    
    		return get_posts( apply_filters( 'wp_ulike_get_top_posts_query', array(
    			'post__in'    => $post__in,
    			'numberposts' => $numberposts,
    			'orderby'     => 'post__in',
    			'post_type'   => $post_type === '' ? get_post_types_by_support( array(
    				'title',
    				'editor',
    				'thumbnail'
    			) ) : $post_type
    		) ) );
    	}
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sorting filter for like’ is closed to new replies.