Sikora TagDiv Post Views Sorter (Admin)
Makes the TagDiv Newspaper theme's "Views" column on the WordPress admin Posts page sortable.
by Sikora Collective · github.com/kevinsikora/sikora-tagdiv-post-views-sorter
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/kevinsikora/sikora-tagdiv-post-views-sorter/archive/refs/heads/main.zipMakes the TagDiv Newspaper theme's "Views" column on the WordPress admin Posts page sortable.
Theme compatibility
This plugin works with the Newspaper theme by TagDiv.
The Newspaper theme adds a Views column to the admin Posts page (Posts → All Posts) and saves each post's view count in the post meta field post_views_count. The theme does not let you sort by that column. This plugin adds sorting.
If the Newspaper theme (or its Views column) is not active, the plugin does nothing.
What it does
- Makes the Views column header on the admin Posts page clickable for sorting, like the Title and Date columns.
- Sorts by view count in descending order (most viewed first) on the first click. Click again to switch to ascending.
- Treats posts with no recorded view count as 0 views, so they stay in the list.
- Breaks ties between posts with the same view count by publish date.
- Works with the Posts page's existing filters, search, and pagination.
What it does not do
- It does not change the database. The plugin only reads the theme's existing view counts. It creates no options, tables, or post meta, and it has no activation or uninstall routines.
- It does not count views, change view counts, or change how the Views column looks.
- It does not change anything on the public side of the site. It only runs in the WordPress admin.
Installation
- In the WordPress admin, go to Plugins → Add New Plugin → Upload Plugin.
- Choose
sikora-tagdiv-post-views-sorter.zipand click Install Now. - Click Activate Plugin.
- Go to Posts → All Posts and click the Views column header.
To remove it, deactivate and delete the plugin from the Plugins page. There is no data to clean up.
How it works (technical)
- On the Posts list screen (
edit.php, post typepost), the plugin reads the final list of columns (after every column filter has run) and finds the theme's Views column. It looks for the column keytd_post_viewsfirst, then a column labeled "Views", then any column whose key contains "view". - It registers that column through the
manage_edit-post_sortable_columnsfilter with the orderby valuesikora_td_views, set to sort descending first. - When the main admin query is sorted by
sikora_td_views, aposts_orderbyfilter orders posts by the numeric value of thepost_views_countmeta field. It reads the value with a read-only subquery, so posts with no count are kept and sorted as 0.
Requirements
- WordPress 5.0 or later
- PHP 7.0 or later
- TagDiv Newspaper theme
Files
| File | Purpose |
|---|---|
sikora-tagdiv-post-views-sorter.php |
The plugin (documented inline). |
README.md |
This file. |
License
GPL-2.0-or-later