pfeifferNet

View
in package

Counts page and post views.

  • Data is held in post_meta for each page or post.
Tags
since
1.0.0
since
5.5.0

Inherit standard singleton class.

since
5.11.0

Deprecated global singleton.

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
since
5.3.0

Properties

$blog_page_id

Blog page id.

protected int $blog_page_id = 0
Tags
since
1.7.0

$instances

The array of instances of this class and sub-classes.

protected static array<string|int, object> $instances = array()
Tags
since
5.11.0

Methods

get_instance()

Creates and/or returns the instance of this class.

public static get_instance() : object
Tags
since
5.11.0
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
since
1.0.0

__construct()

Initialise the class.

protected __construct() : void
Tags
since
1.0.0

        
On this page

Search results