Counter
Displays the post view count in content and feeds.
Namespace: WebberZone\Top_Ten
Since: 3.3.0
Source: includes/class-counter.php line 23
Methods
__construct()
Constructor class.
Since: 3.3.0
Line: 30
public function __construct( );
the_content() static
Adds the viewed count to the post content. Filters the_content.
Since: 3.3.0
Line: 45
static public function the_content( $content ): string;
| Type | Name | Description |
|---|---|---|
string |
$content |
Post content. |
Returns: string — Filtered post content.
rss_filter() static
Filter to display the post count when viewing feeds.
Since: 1.9.8
Line: 93
static public function rss_filter( $content ): string;
| Type | Name | Description |
|---|---|---|
string |
$content |
Post content. |
Returns: string — Filtered post content
echo_post_count() static
Function to manually display count.
Since: 1.0
Line: 114
static public function echo_post_count( $echo_output = ... ): string|void;
| Type | Name | Description |
|---|---|---|
int|boolean |
$echo_output |
Flag to echo the output. |
Returns: string|void — Formatted string if $echo_output is set to 0|false
get_post_count() static
Return the formatted post count for the supplied ID.
Since: 3.3.0
Line: 189
static public function get_post_count( $post = ..., $blog_id = ..., $args = ... ): string;
| Type | Name | Description |
|---|---|---|
int|string|\WP_Post |
$post |
Post ID or WP_Post object. |
int|string |
$blog_id |
Blog ID. |
array |
$args |
Additional arguments. |
Returns: string — Formatted post count
get_post_count_only() static
Returns the post count.
Since: 3.3.0
Line: 261
static public function get_post_count_only( $post = ..., $counter = ..., $blog_id = ..., $args = ... ): int|string;
| Type | Name | Description |
|---|---|---|
int|\WP_Post |
$post |
Post ID or WP_Post object. |
string |
$counter |
Which count to return? total, daily or overall. |
int |
$blog_id |
Blog ID. |
array |
$args |
Additional arguments. |
Returns: int|string — Post count
delete_counts() static
Delete the counts from the selected table.
Since: 3.3.0
Line: 343
static public function delete_counts( $args = ... ): int|false;
| Type | Name | Description |
|---|---|---|
string|array |
$args |
{ |
Returns: int|false — The number of rows updated, or false on error.
delete_count() static
Delete post count.
Since: 3.3.0
Line: 385
static public function delete_count( $post_id, $blog_id, $daily = ... ): bool|int;
| Type | Name | Description |
|---|---|---|
int |
$post_id |
Post ID. |
int |
$blog_id |
Blog ID. |
bool |
$daily |
Daily flag. |
Returns: bool|int — Number of rows affected or false if error.
edit_count_ajax() static
Function to update the Top 10 count with ajax.
Since: 3.3.0
Line: 412
static public function edit_count_ajax( );
edit_count() static
Edit post count.
Since: 3.3.0
Line: 470
static public function edit_count( $post_id, $blog_id, $total_count ): bool|int;
| Type | Name | Description |
|---|---|---|
int |
$post_id |
Post ID. |
int |
$blog_id |
Blog ID. |
int |
$total_count |
Total count. |
Returns: bool|int — Number of rows affected or false if error.