Support » Plugin: WP ULike » How to specify period in wp_query

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

    (@alimir)

    @exfillion This structure has been disabled in a recent update. Please try to use the following structure:

    	/**
    	 * 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
    		) ) );
    	}

    @alimir

    It worked fine using wp_ulike_get_most_liked_posts.
    Thank you very much.

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