WordPress教程

WordPress 后台用户列表怎么按文章数排序

阿里云

WordPress 后台用户列表怎么按文章数排序,在当前 WordPress 模板函数文件 functions.php 添加以下代码即可:

  1. //wp后台按文章数排序
  2. /*
  3. Plugin Name: Sort Users by Post Count
  4. Description: Add a column to the Users page in the admin to sort users by post counts.https://github.com/ksemel/sort-users-by-post-count
  5. Version: 1.0
  6. Author: Katherine Semel
  7. */
  8. if ( ! class_exists('Sort_Users_By_Post_Count') ) {
  9.     class Sort_Users_By_Post_Count {
  10.         function Sort_Users_By_Post_Count() {
  11.             // Make user table sortable by post count
  12.             add_filter( 'manage_users_sortable_columns', array( $this, 'add_custom_user_sorts' ) );
  13.         }
  14.         /* Add sorting by post count to user page */
  15.         function add_custom_user_sorts( $columns ) {
  16.             $columns['posts'] = 'post_count';
  17.             return $columns;
  18.         }
  19.     }
  20.     $Sort_Users_By_Post_Count = new Sort_Users_By_Post_Count();
  21. }
也想出现在这里?联系我们
创客主机

WordPress 后台用户列表怎么按文章数排序

已有 167 人购买
查看演示升级 VIP立刻购买

收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!