View
in package
Counts page and post views.
- Data is held in post_meta for each page or post.
Tags
Table of Contents
Constants
- META_KEY = 'pnet_views_count'
- Define meta key for storing view counts.
Properties
- $blog_page_id : int
- Blog page id.
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
Methods
- get_instance() : object
- Creates and/or returns the instance of this class.
- set_view_count() : void
- Initialises, increments and stores page view counter.
- __construct() : void
- Initialise the class.
Constants
META_KEY
Define meta key for storing view counts.
protected
string
META_KEY
= 'pnet_views_count'
Tags
Properties
$blog_page_id
Blog page id.
protected
int
$blog_page_id
= 0
Tags
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
Methods
get_instance()
Creates and/or returns the instance of this class.
public
static get_instance() : object
Tags
Return values
object —The instance of this class.
set_view_count()
Initialises, increments and stores page view counter.
public
set_view_count() : void
- Tracks views for each post and page.
Tags
__construct()
Initialise the class.
protected
__construct() : void