Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #52307
    MacKen
    Participant

    Post_views not working in amp plugin and add oderby rand

    PLz add

    /**
    * Get most viewed posts.
    *
    * @param array $args
    * @return array
    */
    if ( ! function_exists( ‘pvc_get_most_viewed_posts’ ) ) {

    function pvc_get_most_viewed_posts( $args = [] ) {
    $args = array_merge(
    [
    ‘posts_per_page’ => 10,
    ‘order’ => ‘desc’,
    ‘post_type’ => ‘post’,
    ‘fields’ => ”
    ],
    $args
    );

    $args = apply_filters( ‘pvc_get_most_viewed_posts_args’, $args );

    // force to use filters
    $args[‘suppress_filters’] = false;

    // force to use post views as order
    $args[‘orderby’] = ‘post_views’;

    return apply_filters( ‘pvc_get_most_viewed_posts’, get_posts( $args ), $args );
    }

    }

    #52342
    Bartosz
    Keymaster

    Hi,

    It does not have AMP support.

    There is a Pro version of the plugin coming that will have a built in AMP support (including lot’s of other more advanced features)

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