热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

wordpress用户注册_如何显示WordPress中的注册用户总数

wordpress用户注册HaveyoueverwantedtoshowthetotalnumberofregisteredusersonyourWordPresssite?Soc

wordpress用户注册

Have you ever wanted to show the total number of registered users on your WordPress site? Social proof like showing the number of registered users on your site, encourages others to register as well. In this article, we will show you how to show total number of registered users in WordPress.

您是否曾经想显示您的WordPress网站上的注册用户总数? 社会证明,例如显示您网站上注册用户的数量,也鼓励其他人也进行注册。 在本文中,我们将向您展示如何显示WordPress中的注册用户总数。

How to Show Total Number of Registered Users in WordPress

方法1:使用WordPress插件显示注册用户数 (Method 1: Show Registered User Count Using a WordPress Plugin)

First thing you need to do is install and activate the Simple Blog Stats plugin. For more details, see our step by step guide on how to install a WordPress plugin.

您需要做的第一件事是安装并激活Simple Blog Stats插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。

Upon activation, you need to visit Settings » Simple Blog Stats page to configure plugin settings.

激活后,您需要访问设置»简单博客统计信息页面来配置插件设置。

Settings page for Simple Blog Stats

This plugin allows you to show different stats from your WordPress site. You need to click on the shortcodes tab to expand it and then scroll down to the ‘number of users’ row.

该插件可让您显示WordPress网站的不同统计信息。 您需要单击“简码”选项卡将其展开,然后向下滚动到“用户数”行。

Users shortcode settings

You will see the shortcode [sbs_users] with two text fields on both sides. These text fields contain HTML the plugin will add before and after the number of users.

您将看到在两侧都有两个文本字段的简码 [sbs_users] 。 这些文本字段包含插件将在用户数量之前和之后添加HTML。

By default, the shortcode will output HTML like this:

默认情况下,简码将输出如下所示HTML:


856

If you are unsure, then just copy the shortcode [sbs_users] and click on the save settings button.

如果不确定,则只需复制简码[sbs_users] ,然后单击“保存设置”按钮。

You can now add this shortcode to any WordPress post or page. You can also add it to a sidebar widget. If the shortcode does not work in the widget, then follow instructions in our guide on how to use shortcodes in your WordPress sidebar widget.

现在,您可以将此简码添加到任何WordPress 帖子或页面中 。 您也可以将其添加到侧边栏小部件中 。 如果该短代码在窗口小部件中不起作用,请按照我们的指南中有关如何在WordPress边栏窗口小部件中使用短代码的说明进行操作 。

方法2:使用代码手动显示WordPress中的注册用户数 (Method 2: Manually Show Number of Registered Users in WordPress with Code)

This method requires you to add code to your WordPress site. If you haven’t done this before, then see our beginner’s guide on pasting snippets from web into WordPress.

此方法要求您将代码添加到WordPress网站。 如果您以前从未这样做过,请参阅有关将网页摘要粘贴到WordPress的初学者指南。

You need to add the following code to your theme’s functions.php file or a site-specific plugin.

您需要将以下代码添加到主题的functions.php文件或特定于站点的插件中 。


// Function to return user count
function wpb_user_count() {
$usercount = count_users();
$result = $usercount['total_users'];
return $result;
}
// Creating a shortcode to display user count
add_shortcode('user_count', 'wpb_user_count');

This code creates shortcode [user_count] which you can use in your WordPress posts, pages, or a sidebar widget to display the user count.

这段代码创建了简码[user_count] ,您可以在WordPress帖子,页面或侧边栏小部件中使用它来显示用户数。

The function does not add any HTML formatting to the user count and simply returns the number. You may want to wrap the shortcode around HTML to use CSS or basic HTML formatting. For example:

该函数不会向用户计数中添加任何HTML格式,而只是返回数字。 您可能需要将简短代码包装在HTML周围,以使用CSS或基本HTML格式。 例如:


Join [user_count] other users who share your interest:



Here is how it looked on our demo site:

这是在我们的演示站点上的外观:

Showing total number of users in WordPress widget

Note: We added a free signup button that redirected to a custom WordPress user registration page.

注意:我们添加了一个免费的注册按钮,可将其重定向到自定义WordPress用户注册页面 。

That’s all, we hope this article helped you learn how to show the total number of registered users in WordPress. You may also want to see our guide on how to moderate new user registrations in WordPress.

仅此而已,我们希望本文能帮助您学习如何显示WordPress中的注册用户总数。 您可能还希望查看我们的指南,了解如何审核WordPress中的新用户注册 。

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在Twitter和Facebook上找到我们。

翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-show-total-number-of-registered-users-in-wordpress/

wordpress用户注册



推荐阅读
  • VScode格式化文档换行或不换行的设置方法
    本文介绍了在VScode中设置格式化文档换行或不换行的方法,包括使用插件和修改settings.json文件的内容。详细步骤为:找到settings.json文件,将其中的代码替换为指定的代码。 ... [详细]
  • 展开全部下面的代码是创建一个立方体Thisexamplescreatesanddisplaysasimplebox.#Thefirstlineloadstheinit_disp ... [详细]
  • 本文介绍了三种方法来实现在Win7系统中显示桌面的快捷方式,包括使用任务栏快速启动栏、运行命令和自己创建快捷方式的方法。具体操作步骤详细说明,并提供了保存图标的路径,方便以后使用。 ... [详细]
  • Flutter App 中创建模块并且依赖 Flutter
    在FlutterApp中打开对应的Android工程;并且向Android原生工程添加一个AndroidModule模块,并且在工程根settings. ... [详细]
  • 有没有一种方法可以在不继承UIAlertController的子类或不涉及UIAlertActions的情况下 ... [详细]
  • ALTERTABLE通过更改、添加、除去列和约束,或者通过启用或禁用约束和触发器来更改表的定义。语法ALTERTABLEtable{[ALTERCOLUMNcolu ... [详细]
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • win10电脑蓝屏代码0x000000a5无法进入系统解决方法详解
    许多用户在使用电脑的时候遇到蓝屏问题,重启无法进入系统。本文提供了解决方法:调整BIOS设置、禁用安全启动、重装系统等。如果以上方法都无法解决问题,需要重新安装一个系统。详细步骤请参考正文内容。 ... [详细]
  • Android开发实现的计时器功能示例
    本文分享了Android开发实现的计时器功能示例,包括效果图、布局和按钮的使用。通过使用Chronometer控件,可以实现计时器功能。该示例适用于Android平台,供开发者参考。 ... [详细]
  • Go Cobra命令行工具入门教程
    本文介绍了Go语言实现的命令行工具Cobra的基本概念、安装方法和入门实践。Cobra被广泛应用于各种项目中,如Kubernetes、Hugo和Github CLI等。通过使用Cobra,我们可以快速创建命令行工具,适用于写测试脚本和各种服务的Admin CLI。文章还通过一个简单的demo演示了Cobra的使用方法。 ... [详细]
  • CentOS 6.5安装VMware Tools及共享文件夹显示问题解决方法
    本文介绍了在CentOS 6.5上安装VMware Tools及解决共享文件夹显示问题的方法。包括清空CD/DVD使用的ISO镜像文件、创建挂载目录、改变光驱设备的读写权限等步骤。最后给出了拷贝解压VMware Tools的操作。 ... [详细]
  • 在Xamarin XAML语言中如何在页面级别构建ControlTemplate控件模板
    本文介绍了在Xamarin XAML语言中如何在页面级别构建ControlTemplate控件模板的方法和步骤,包括将ResourceDictionary添加到页面中以及在ResourceDictionary中实现模板的构建。通过本文的阅读,读者可以了解到在Xamarin XAML语言中构建控件模板的具体操作步骤和语法形式。 ... [详细]
  • 基于dlib的人脸68特征点提取(眨眼张嘴检测)python版本
    文章目录引言开发环境和库流程设计张嘴和闭眼的检测引言(1)利用Dlib官方训练好的模型“shape_predictor_68_face_landmarks.dat”进行68个点标定 ... [详细]
  • 本文详细介绍了git常用命令及其操作方法,包括查看、添加、提交、删除、找回等操作,以及如何重置修改文件、抛弃工作区修改、将工作文件提交到本地暂存区、从版本库中删除文件等。同时还介绍了如何从暂存区恢复到工作文件、恢复最近一次提交过的状态,以及如何合并多个操作等。 ... [详细]
  • IOS开发之短信发送与拨打电话的方法详解
    本文详细介绍了在IOS开发中实现短信发送和拨打电话的两种方式,一种是使用系统底层发送,虽然无法自定义短信内容和返回原应用,但是简单方便;另一种是使用第三方框架发送,需要导入MessageUI头文件,并遵守MFMessageComposeViewControllerDelegate协议,可以实现自定义短信内容和返回原应用的功能。 ... [详细]
author-avatar
28划生12_928
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有