Support » Plugin: WP ULike » ulike widget Expansion

  • jonney

    (@ganarukanaru)


    ulike widget Expansion。

    I write and output the code myself, but I would like it if I can extend the widget.

    1 select post type.

    2 select bbpress>forum

Viewing 1 replies (of 1 total)
  • Plugin Author Alimir

    (@alimir)

    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
    		) ) );
    	}
    • This reply was modified 2 months, 1 week ago by Alimir.
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.