inpsyde / top-selling-products
Lightweight package providing a pre-configured, yet filterable WP_Query extension for top selling products.
Requires
- php: >=5.4
Requires (Dev)
- brain/monkey: ~1.0
- mockery/mockery: 0.9.*
- phpunit/phpunit: ~4.8|~5.1
This package is auto-updated.
Last update: 2021-02-11 10:30:45 UTC
README
Lightweight package providing a pre-configured, yet filterable
WP_Query
extension for top selling products.
UNMAINTAINED
NOTE: This repository is no longer maintained.
Introduction
This package comes with a WP_Query
extension that allows for querying top selling products.
By default, there is no definition as to when a product is a top seller, though.
This can either be done by passing according query arguments, or filtering the given or default ones.
Installation
$ composer require inpsyde/top-selling-products:~1.0
Run the tests:
$ vendor/bin/phpunit
Requirements
This package requires PHP 5.4 or higher.
Usage
Filters
inpsyde_top_selling_products.query_args
This hook allows to filter the query arguments.
Arguments:
array
$args
: Query arguments.
<?php add_filter( 'inpsyde_top_selling_products.query_args' , function( array $args ) { // Randomize the results, but exclude posts with specific IDs. return array_merge( $args, [ 'post__not_in' => [ 4, 8, 15, 16, 23, 42 ], 'orderby' => 'rand', ] ); } );
License
Copyright (c) 2016 Inpsyde GmbH, Thorsten Frommen
This code is licensed under this License.