mycred_count_all_ref_instances
Description
This function returns an associative array of references and their individual counts from the log.
Available since version 1.3.3
Returns
(array) Associative array of references and counts.
Parameters
| Param | Type | Required | Description | |
|---|---|---|---|---|
function mycred_count_all_ref_instances( |
||||
$number |
int | Yes | The number of references to return a count for. Use |
|
$order |
string | No | Sorting order. Either Ascending (ASC) or Descending (DESC). Defaults to |
|
$type |
string | No | Option to filter the count based on a point type. Must be either a point type key or the string |
|
) { ... } |
||||
Examples
Example 1: Get all references with their count no matter which point type they belong to.
$references = mycred_count_all_ref_instances( -1, 'DESC', 'all' );
if ( ! empty( $references ) ) {
foreach ( $references as $reference => $count ) {
echo $reference . ' ' . $count;
}
} Example 2: Get the top 10 references for the default point type.
$count = mycred_count_all_ref_instances( 10 );
if ( ! empty( $references ) ) {
foreach ( $references as $reference => $count ) {
echo $reference . ' ' . $count;
}
}