Init View Count – Minimal, Accurate, Extensible Wordpress Plugin - Rating, Reviews, Demo & Download
Plugin Description
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 thepageattribute
This plugin is part of the Init Plugin Suite — a collection of minimalist, fast, and developer-focused tools for WordPress.
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)
Shortcodes
`[init_view_count]`
Shows current view count for a post. Only works inside a post loop.
Attributes:
– format: formatted (default), raw, or short
– field: total, day, week, month
– time: true to show time diff from post date (e.g. “3 days ago”)
`[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 a view for a given post ID.
Parameters:
– post_id — (int) Required. The post ID 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.
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.
Template Override
To customize output layout, copy any template file into your theme:
Example:
your-theme/init-view-count/view-list-grid.php
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_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
Screenshots
Plugin settings page – configure post types, view types, delay, scroll check, and storage method.
Shortcode builder for [init_view_list] – generate view-based post lists with custom templates.
Shortcode builder for [init_view_ranking] – generate tabbed rankings for different view ranges.
Shortcode builder for [init_view_count] – display view count for current post with format options.
Frontend view – ranking display (all time), light mode interface.
Frontend view – ranking display (this week), dark mode interface.
