Function Reference: geodir_count_posts_by_term

Summary

Count posts by term.

Package

GeoDirectory

Parameters

$data
(array) (required) Count data array.

Default: None
$term
(object) (required) The term object.

Default: None

Return Values

(int)
  • Post count.

Change Log

Since: 1.0.0

Source File

geodir_count_posts_by_term() is located in geodirectory-functions/general_functions.php [Line: 4146]

Source Code

function geodir_count_posts_by_term( $data, $term ) {

	if ( $data ) {
		if ( isset( $data[ $term->term_id ] ) ) {
			return $data[ $term->term_id ];
		} else {
			return 0;
		}
	} else {
		return $term->count;
	}
}