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
    		) ) );
    	}
    Thread Starter Fillio

    (@exfillion)

    @alimir

    It worked fine using wp_ulike_get_most_liked_posts.
    Thank you very much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to specify period in wp_query’ is closed to new replies.