Most active authors 图片上一篇文章扩展 wp_list_authors 显示最活跃 文章最多的作者仅仅能够显示文章的作者名称,今天给 wp_list_authors 增加了 Gravatar 头像以及不显示指定用户的功能。

变量:

增加 gravatar 控制变量:only_gravatar、with_gravatar 和 size,不显示指定用户变量:exclude_users。

扩展参数说明:

only_gravatar
(boolean) 仅输出作者 Gravatar 头像。

  • false (不显示— 默认)
  • true (仅显示头像,size 和 exclude_users 参数有效,其他参数均失效)
with_gravatar
(boolean) 在作者姓名前显示 Gravatar 头像。

  • false (不显示— 默认)
  • true ( 显示)
size
(int) Gravatar 头像尺寸。

  • 32 ( 默认)
exclude_users
(string) 不显示指定用户。默认无指定。

用法:

显示文章最多的前10名作者、文章数量:

<?php most_active_authors('optioncount=1&limit=10'); ?>

显示效果:

Most Active Author

在作者姓名前显示 gravatar 头像,头像大小为16px:

<?php most_active_authors('optioncount=1&with_gravatar=1&size=16'); ?>

显示效果:

m11

仅显示 gravatar 头像:

<?php most_active_authors('only_gravatar=1'); ?>

显示效果:

Most Active Authors

不显示指定用户,可指定多个用户,用英文逗号隔开:

<?php most_active_authors('only_gravatar=1&exclude_users=submitter,mimimama'); ?>

更多内容请参考 扩展 wp_list_authors 显示最活跃 文章最多的作者

预览 下载