
前言介紹
- 這款 WordPress 外掛「Init View Count – AI-Powered, Trending, REST API」是 2025-06-16 上架。
- 目前有 100 個安裝啟用數。
- 上一次更新是 2025-10-26,距離現在已有 122 天。
- 外掛最低要求 WordPress 5.5 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 7.4 以上。
- 有 3 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
rest-api | shortcode | post views | View Counter | trending posts |
內容簡介
總結:Init View Count 是一個快速乾淨的外掛,用來追蹤文章瀏覽次數,無需冗贅。它利用 REST API 和 JS 來計算實際瀏覽次數,並且避免重複計算,將計數存儲在像 _init_view_count、_init_view_day_count 等元數鍵中。這個外掛是 Init Plugin Suite 的一部分,這是一個專為 WordPress 開發者設計的極簡、快速的工具集。
問題:
1. Init View Count 的外掛是用什麼技術來計算實際瀏覽次數的?
2. 內容提到 Init View Count 的外掛支持什麼類型的短代碼?
3. 使用 [init_view_list] 短代碼時,可以透過哪個屬性來設定顯示的文章數量?
4. 外掛提到支持模板覆蓋,可以使用什麼來覆蓋預設模板?
5. Init View Count 外掛與哪些框架完全兼容?
原文外掛簡介
Init View Count is a fast, clean plugin to track post views without clutter. It:
Uses REST API and JS to count real views
Prevents duplicate counts with session/local storage
Stores counts in meta keys like _init_view_count, _init_view_day_count, etc.
Provides [init_view_count] and [init_view_list] shortcodes
Includes [init_view_ranking] shortcode with tabbed ranking by time range
Supports template overrides (like WooCommerce)
Lightweight. No tracking, no admin bloat.
Includes REST API to query most viewed posts
Supports pagination in [init_view_list] via the page attribute
Batch view tracking support to reduce REST requests on busy sites
Optional strict IP-based filtering to block fake view requests posted directly to the REST endpoint
Includes a Dashboard widget to monitor top viewed posts directly in wp-admin
Learns site-wide traffic shape (hourly & weekday) via AI-powered smoothing
Shapes cached and updated efficiently with minimal overhead
Safe reset action to rebuild patterns automatically
Fully integrated with Trending Engine v3 for uplift-based scoring
This plugin is part of the Init Plugin Suite — a collection of minimalist, fast, and developer-focused tools for WordPress.
GitHub repository: https://github.com/brokensmile2103/init-view-count
Highlights
REST-first design — no jQuery or legacy Ajax
View tracking powered by time + scroll detection
Realtime display with optional animated counters
Fully theme-compatible with overrideable templates
Developer-friendly with rich filter support
Optional [init_view_ranking] shortcode for tabbed view by day/week/month/total
Assets are only loaded when needed – perfect for performance-conscious themes
Fully compatible with headless and SPA frameworks (REST-first + lazy)
Supports batch mode: delay view requests and send in groups (configurable in settings)
Includes optional Dashboard widget for quick admin overview of top viewed posts
AI-powered Traffic Shape Learner – understands your site’s hourly & weekly rhythm
Auto-integrated with Trending Engine v3 for seasonality-aware uplift detection
Smart fallbacks (day → week → month → total) ensure rankings never run empty
Ultra-light: only 1 write per increment + 1 rollup per day, cache-first design
Shortcodes
[init_view_count]
Shows current view count for a post. Only works inside a post loop.
Attributes:
– field: total (default), day, week, month – which counter to display
– format: formatted (default), raw, or short – controls number formatting
– time: true to show time diff from post date (e.g. “3 days ago”)
– icon: true to display a small SVG icon before the count
– schema: true to output schema.org microdata (InteractionCounter)
– class: add a custom CSS class to the outer wrapper
[init_view_list]
Show list of most viewed posts.
Attributes:
– number: Number of posts to show (default: 5)
– page: Show a specific page of results (default: 1)
– post_type: Type of post (default: post)
– template: sidebar (default), full, grid, details (can be overridden)
– title: Title above list. Set to empty (title="") to hide
– class: Custom class added to wrapper
– orderby: Sort field (default: meta_value_num)
– order: ASC or DESC (default: DESC)
– range: total, day, week, month, trending
– category: Filter by category slug
– tag: Filter by tag slug
– empty: Message to show if no posts found
[init_view_ranking]
Show tabbed ranking of most viewed posts. Uses REST API and JavaScript for dynamic loading. Optimized for SPA/headless usage.
Attributes:
– tabs: Comma-separated list of ranges. Available: total, day, week, month (default: all)
– number: Number of posts per tab (default: 5)
– class: Custom class for outer wrapper
This shortcode automatically enqueues required JS and uses skeleton loaders while fetching data.
REST API
This plugin exposes two REST endpoints to interact with view counts: one for recording views and another for retrieving top posts.
POST /wp-json/initvico/v1/count
Record one or more views. Accepts a single post ID or an array of post IDs.
Parameters:
– post_id — (int|array) Required. One or more post IDs to increment view count for.
This endpoint checks if the post is published, belongs to a supported post type, and applies delay/scroll config (via JavaScript). It updates total and optionally day/week/month view counters.
Note: The number of post IDs processed per request is limited based on the batch setting in plugin options.
GET /wp-json/initvico/v1/top
Retrieve the most viewed posts, ranked by view count.
Parameters:
– range — (string) total, day, week, month. Defaults to total.
– post_type — (string) Post type to query. Defaults to post.
– number — (int) Number of posts to return. Default: 5.
– page — (int) Pagination offset. Default: 1.
– fields — (string) minimal (id, title, link) or full (includes excerpt, thumbnail, type, date, etc.)
– tax — (string) Optional. Taxonomy slug (e.g. category).
– terms — (string) Comma-separated term slugs or IDs.
– no_cache — (bool) If 1, disables transient caching.
This endpoint supports filtering and caching, and can be extended to support custom output formats.
Filters for Developers
This plugin provides multiple filters to help developers customize behavior and output in both REST API and shortcode use cases.
init_plugin_suite_view_count_should_count
Allow or prevent counting views for a specific post.
Applies to: REST /count
Params: bool $should_count, int $post_id, WP_REST_Request $request
init_plugin_suite_view_count_meta_key
Change the meta key used to read or write view counts.
Applies to: REST & Shortcodes
Params: string $meta_key, int|null $post_id
init_plugin_suite_view_count_after_counted
Run custom logic after view count has been incremented.
Applies to: REST /count
Params: int $post_id, array $updated, WP_REST_Request $request
init_plugin_suite_view_count_api_top_args
Customize WP_Query arguments used for /top endpoint.
Applies to: REST /top
Params: array $args, WP_REST_Request $request
init_plugin_suite_view_count_api_top_item
Modify each item before it’s returned in the /top response.
Applies to: REST /top
Params: array $item, WP_Post $post, WP_REST_Request $request
init_plugin_suite_view_count_api_top_cache_time
Adjust cache time (in seconds) for /top results.
Applies to: REST /top
Params: int $ttl, WP_REST_Request $request
init_plugin_suite_view_count_top_post_types
Customize the list of post types returned by the /top endpoint.
Applies to: REST /top
Params: array $post_types, WP_REST_Request $request
init_plugin_suite_view_count_query_args
Filter WP_Query args for [init_view_list] shortcode.
Applies to: [init_view_list]
Params: array $args, array $atts
init_plugin_suite_view_count_empty_output
Customize the HTML output when no posts are found.
Applies to: [init_view_list]
Params: string $output, array $atts
init_plugin_suite_view_count_view_list_atts
Modify shortcode attributes before WP_Query is run.
Applies to: [init_view_list]
Params: array $atts
init_plugin_suite_view_count_default_shortcode
Customize the default shortcode used when auto-inserting view count into post content.
Applies to: [init_view_count] auto-insert
Params: string $shortcode
init_plugin_suite_view_count_auto_insert_enabled
Control whether auto-insert is enabled for a given context.
Applies to: [init_view_count] auto-insert
Params: bool $enabled, string $position, string $post_type
init_plugin_suite_view_count_engagement_meta_keys
Change the meta keys used to retrieve like and share counts when calculating engagement quality.
Applies to: Engagement algorithm
Params: array $meta_keys (likes, shares), int $post_id
init_plugin_suite_view_count_trending_post_types
Override the list of post types used by the Trending cron calculation.
Applies to: Cron Trending
Params: array $post_types
init_plugin_suite_view_count_trending_component_weights
Adjust weights for Trending score components.
Applies to: Trending algorithm
Params: array $weights (velocity, engagement, freshness, momentum)
Template Override
To customize output layout, copy any template file into your theme:
Example: your-theme/init-view-count/view-list-grid.php
License
This plugin is licensed under the GPLv2 or later.
You are free to use, modify, and distribute it under the same license.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Init View Count – AI-Powered, Trending, REST API」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.5 | 1.6 | 1.7 | 1.8 | 1.9 | 1.10 | 1.11 | 1.12 | 1.13 | 1.14 | 1.15 | 1.16 | 1.17 | 1.18 | 1.19 | trunk | 1.19.1 | 1.19.2 |
延伸相關外掛(你可能也想知道)
WooCommerce Legacy REST API 》總結:, - 在WooCommerce 9.0版本起,Legacy REST API將不再是WooCommerce的一部分。, - 這款外掛程式在WooCommerce 9.0及以後版本中還原了已移除的Legacy RE...。
Disable REST API 》這是最全面的 WordPress REST API 存取控制外掛!, 輕鬆安裝,安裝後不需要額外設定即可使用。只需上傳並啟用,整個 REST API 將無法被一般訪客存取。, 但如...。Make Connector 》Make 是一個視覺化平台,讓你可以在幾分鐘內設計、建立和自動化任何事情 - 從簡單的任務到複雜的工作流程。使用 Make,你可以在 WordPress 和數千個應用程式...。
JWT Authentication for WP REST API 》此外掛使用 JSON Web Tokens (JWT) 做為驗證方式,擴充了 WP REST API 。JSON Web Tokens 是一種開放且具有行業標準的方法,用來在兩方之間安全地傳遞聲明。,...。
WPGraphQL 》WPGraphQL 是一個免費、開源的 WordPress 外掛,為任何 WordPress 網站提供可延伸的 GraphQL schema 和 API。, 以下是一些有助於你開始使用 WPGraphQL 的連結...。
Disable WP REST API 》這個外掛只有一個功能:禁用沒有登入 WordPress 的訪客使用 WP REST API。不需要任何設定。, 這個外掛只有 22 行短小的程式碼(少於 2KB)。因此它非常輕量、...。
JWT Authentication for WP REST APIs 》WordPress REST API 預設是鬆散的端點,駭客可以通過這些端點遠程控制您的網站。 您不希望駭客可以透過 WordPress 登錄和 WordPress 註冊或任何其他端點來獲...。
WordPress REST API (Version 2) 》WordPress 正轉變成一個完整的應用程式框架,因此需要新的 API。這個專案的目的是創建一個易於使用、易於理解且經過良好測試的框架,用於創建這些 API,以及...。Application Passwords 》⚠️ 重要提示:此外掛已合併至 WordPress 5.6 核心,不需要單獨安裝。 查看整合指南→, 使用應用程式密碼進行身份驗證,而不必直接提供用戶的密碼。相反,為每...。
WP REST API – OAuth 1.0a Server 》使用這個外掛,您可以將應用程式連接至您的 WordPress 網站,而不必透露您的密碼。, 此外掛使用 OAuth 1.0a 協議,允許委派授權,即允許應用程式使用一組次要...。Contact Form to Any API 》, 「Contact form 7 to Any API」是一款強大的外掛,能夠將聯絡表單 CF7 的數據傳送至任何第三方服務。使用者可以透過這款外掛將數據發送到客戶關係管理(CRM...。
REST API Log 》這是一款針對 WordPress REST API v2 的外掛程式,可記錄 REST API 的請求和回應紀錄。, 功能包括:, , WordPress 管理頁面,用於查看和搜尋日誌條目, API 端...。
SMNTCS Disable REST API User Endpoints 》隨著 WordPress 4.7 的推出,REST API 已經成為核心的一部分。目前,每個人都可以讀取 REST API。因此,潛在的入侵者可以通過 /wp-json/wp/v2/users 檢索所有...。
REST API Toolbox 》此外掛允許調整多個 REST API 設定, , 停用 REST API, 移除 WordPress 核心端點, 需要核心端點驗證, 強制使用 SSL, WP-CLI 命令: wp rest-api-toolbox, , 在 ...。
Automatik Blog 》總結:Automatik Blog 外掛透過提供自訂端點來擴展 WordPress REST API,使得用戶可以發佈文章、更新文章、上傳圖片和管理分類。該外掛旨在促進 WordPress 和...。
