Closed henrywright closed 3 months ago
You should be able to add support for the offset
parameter with this snippet:
add_filter( 'edd_downloads_query', 'prefix_add_offset_downloads', 10, 2 );
/**
* Add an offset to the downloads query.
*
* @param array $query
* @param array $attributes
* @return array
*/
function prefix_add_offset_downloads( $query, $attributes ) {
if ( ! empty( $attributes['offset'] ) ) {
$query['offset'] = absint( $attributes['offset'] );
}
return $query;
}
However, if your goal is to show the least expensive items in that category, maybe it would be easier to add order="ASC"
to the shortcode for the second use (DESC
is the default). That way, if you add another item to the category, you should not have to update the shortcode offset value.
If you have more questions on this, please contact our support team and they'll be happy to help.
Thanks for the filter @robincornett
I don't think the
downloads
shortcode acceptsoffset
when displaying a set of downloads.offset
is useful in cases where the shortcode is being used multiple times on the same web page. Here is an example:Most expensive downloads in a given category
[downloads category="7" orderby="price" number="6"]
Affordable downloads in the same given category
[downloads category="7" orderby="price" number="6" offset="26"]