Skip to content

Counts and displays the number of times that an entry has been viewed in Craft CMS.

License

Notifications You must be signed in to change notification settings

ul8/craft-entry-count

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Entry Count Plugin for Craft CMS 3

The Entry Count Plugin was built specifically for training purposes and is used in the Craft Plugin Development video course.

It allows you to count and display the number of times that an entry has been viewed in Craft CMS.

Requirements

Craft CMS 3.0.0 or later.

Installation

To install the plugin, search for "Entry Count" in the Craft Plugin Store, or install manually using composer.

composer require putyourlightson/entry-count

Twig Tags

count(entry.id)

{% set count = craft.entryCount.count(entry.id) %}

Entry count: {{ count }}
First count: {{ count.dateCreated }}
Last count: {{ count.dateUpdated }}

entries

{% set entries = craft.entryCount.entries.all() %}

{% for entry in entries %}
    {% set count = craft.entryCount.count(entry.id) %}
    {{ entry.title }} ({{ count }} views)
{% endfor %}

increment(entry.id)

{% do craft.entryCount.increment(entry.id) %}

Plugin icon by Made by Made from the Noun Project

About

Counts and displays the number of times that an entry has been viewed in Craft CMS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 82.1%
  • HTML 17.9%