=== PV Sort Plus for Cocoon ===
Contributors: kasuga16
Donate link: https://www.paypal.me/kasuga16
Tags: cocoon, pv, page views, sort, posts
Requires at least: 6.3
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.5
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

An extension plugin for the Cocoon theme. Adds period-based PV, modified date, and elapsed days columns to the posts list and enables sorting.

== Description ==

**PV Sort Plus for Cocoon** is an admin-side enhancement plugin designed exclusively for the **Cocoon theme**.

It adds the following custom columns to the WordPress admin **Posts list** and allows **click-based sorting** for each column.

* **PV / Day** (PV/D)
* **PV / Week** (PV/W)
* **PV / Month** (PV/M)
* **PV / Total** (PV/All)
* **Modified Date** (Modified)
* **Days Since Modified** (Mod-D) – days since the last update
* **Days Since Published** (Pub-D) – days since publication

This plugin reads data directly from Cocoon’s internal `cocoon_accesses` table, so **no external services or additional configuration** are required.

**Note:** This plugin works **only when the Cocoon theme is active**.

---

== 説明 ==

「PV Sort Plus for Cocoon」は、**Cocoonテーマ専用**の管理画面拡張プラグインです。

WordPress管理画面の「投稿一覧」に以下のカスタムカラムを追加し、**クリックによる並び替え（ソート）**を可能にします。

*  **PV/日**
* **PV/週**
* **PV/月**
* **PV/全**
* **更新日**
*  **経過日数** ※最終更新からの経過日数
*  **公開日数** ※公開からの経過日数

Cocoonが内部で使用しているcocoon_accessesテーブルを参照し、**外部サービスや追加設定なし**でPV集計を行います。

※ 本プラグインは **Cocoonテーマが有効な場合のみ動作**します。

== Features ==

* Designed exclusively for the Cocoon theme
* Adds PV-related columns to the posts list
* Sortable by daily, weekly, monthly, and total page views
* Sortable by modified date and elapsed days
* Admin-only functionality (no front-end impact)
* Lightweight and simple design
* Performance optimized with WordPress object cache (`wp_cache`)
* Internationalization (i18n) ready

== Installation ==

**Automatic Installation**

1. Log in to your WordPress admin dashboard.
2. Go to **Plugins → Add New**.
3. Search for **pv-sort-plus-for-cocoon**.
4. Click **Install Now** next to *PV Sort Plus for Cocoon*.
5. After installation, click **Activate**.

**Manual Installation**

1. Download the plugin ZIP file from this page.
2. Log in to your WordPress admin dashboard.
3. Go to **Plugins → Add New**.
4. Click **Upload Plugin** at the top of the page.
5. Select the downloaded ZIP file and click **Install Now**.
6. After installation, click **Activate**.

== Usage ==

1. Open **Posts → All Posts** in the admin dashboard.
2. Click on any added column header (PV/D, PV/W, PV/M, PV/All, Modified, Mod-D, Pub-D).
3. Click again to toggle ascending / descending order.

**Note:** The *Days Since Published (Pub-D)* column applies only to published posts.

== Notes ==

* **This plugin does not work with themes other than Cocoon.**
* **Cocoon’s access counting feature must be enabled.**
* On sites with a large number of posts, the first sort operation may take a little time.
* This plugin affects only the admin area and does not modify front-end output.

== Frequently Asked Questions ==

= Can I use this plugin with themes other than Cocoon? =
No. This plugin is designed exclusively for the Cocoon theme.

= Page view counts are not displayed =
Please make sure that Cocoon’s access counting feature is enabled.

== Screenshots ==
1. All Posts screen

== Changelog ==

= 1.0.5 =
* Fixed: The changes in 1.0.4 to Cocoon theme detection were insufficient, so additional fixes were applied.

= 1.0.4 =
* Improved Cocoon theme detection logic for better parent/child theme compatibility.

= 1.0.3 =
* Initial public release
* Added internationalization support
* Minor admin UI adjustments
* Cache optimization