Start typing to search...

Download Repository – num_rows

Please note: Functionality described on this page requires Download Monitor version 4.0 or above.

Downloads in Download Monitor can be fetched via the Download Repository. num_rows is a method of Download Monitor’s download repository service. The method returns the amount of posts found for given filters. Useful for when you want to paginate your results.

Signature

PHP
<strong>public</strong> <strong>function</strong> <strong>num_rows</strong>( $filters=array() );

Parameters

ParameterTypeDefaultDescription
$filtersarrayarray()The filters that set what downloads will be fetch. Basic WP_Query parameters can be used here with some exceptions. Ignored parameters are post_typeposts_per_pageoffsetpagednopaging.

Examples

Retrieve how many downloads in total the website has

This snippet will fetch an int containing the total downloads the website has.

PHP
$num_rows = download_monitor()->service( 'download_repository' )->num_rows();

Did you know! The retrieve() method uses the same $filters argument as this method. See the documentation page of retrieve() for more examples on various filter examples.

Was this page helpful?
0 0
Start Protecting your WordPress Downloads

Protect and track downloads on WordPress... What are you waiting for?

AI Assistant

Hi, how can I help?

Try asking about