How can I add a counter or something similar to my entries, so that I could loop through the most read articles?
Asked
Active
Viewed 869 times
4
-
1There is a counter plugin that is designed to do exactly this, which is currently in private beta written by Ben Croker. Perhaps if you contact the developer, he might let you participate in the beta. – Douglas McDonald Oct 08 '14 at 16:01
-
@DouglasMcDonald Might want to post that as an actual answer ;) – Brandon Kelly Oct 08 '14 at 16:25
2 Answers
3
Updated: There is an Entry Count plugin that is designed to do exactly this, written by Ben Croker. Thanks Ben!
Douglas McDonald
- 13,457
- 24
- 57
-
-
The Entry Count plugin is available at https://www.putyourlightson.net/craft-entry-count – Ben Croker May 27 '17 at 20:19
1
The Entry Count plugin will do this for you (previously the Counter plugin).
You can loop through the most read articles as follows:
{% set countedEntries = craft.entryCount.entries %}
{% for entry in countedEntries %}
{% set count = craft.entryCount.count(entry.id) %}
{{ entry.title }} ({{ count }} views)
{% endfor %}
Ben Croker
- 7,341
- 26
- 55