=== Post Count Tracker ===
Contributors: amirnafees88
Tags: post views, views counter, post count, elementor, stats
Requires at least: 5.6
Tested up to: 7.1.4
Requires PHP: 8.0
Stable tag: 1.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Track how many times each post is viewed and show the view count after the post content or anywhere with a shortcode.

== Description ==

Post Count Tracker counts how many times each post is viewed and shows the count at the end of the post content. It helps admins and readers see which posts are getting attention, without changing your site's design.

**Features**

* Automatic view counting on single posts.
* View count shown at the end of each post, or placed anywhere with the `[pct_post_count]` shortcode.
* "Views" column on the Posts screen in the admin.
* Custom label text and custom icon from the settings page.
* Works with Elementor: add the shortcode to the Shortcode widget in your single post template.
* Lightweight: no extra JavaScript on the front end and admin assets load only on the plugin's settings page.

== Installation ==

1. Upload the `post-count-tracker` folder to the `/wp-content/plugins/` directory, or install it from Plugins > Add New.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to **Post Count Tracker** in the admin menu to change the text, icon, or switch to shortcode mode.

== Frequently Asked Questions ==

= Can I change the view count text and image? =

Yes. Go to WordPress admin > Post Count Tracker and set your own text and image.

= How do I use the shortcode? =

Enable "Use shortcode" on the settings page, then place `[pct_post_count]` in the Elementor Shortcode widget or the WordPress editor. To show the views of a specific post, use `[pct_post_count id="123"]`. In a PHP template, use `echo do_shortcode( '[pct_post_count]' );`.

= Is it compatible with Elementor? =

Yes. Enable shortcode mode and add the shortcode to your single post template.

= Are my own views and post previews counted? =

Every front-end view of a single post is counted. Post previews are not counted.

= What happens to my data if I delete the plugin? =

Deleting the plugin from the Plugins screen removes its settings and all stored view counts. Deactivating the plugin keeps your data.

== Screenshots ==

1. View count shown at the end of a post.
2. Views column on the Posts screen.
3. Plugin settings page.

== Changelog ==

= 1.2.0 =
* Tested up to WordPress 7.1.4.
* Now requires PHP 8.0 or higher and WordPress 5.6 or higher.
* Fixed: the first view of a post is now counted (it previously showed 0).
* Fixed: the view count no longer appears inside widgets or secondary loops on single posts.
* Fixed: post previews are no longer counted as views.
* Added: settings are now sanitized, and a "Settings saved" message is shown.
* Added: `[pct_post_count id="123"]` support documented on the settings page.
* Added: plugin data is removed when the plugin is deleted.
* Improved: admin scripts and the media library load only on the plugin settings page.
* Improved: removed the empty front-end JavaScript file request.
* Improved: all admin text is translatable; numbers are formatted for the site language.

= 1.1.0 =
* Added settings page to control the shortcode, count view text and image.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.2.0 =
Tested with WordPress 7.1.4 and requires PHP 8.0+. Includes a first-view counting fix, and performance improvements.
