Increasing User Engagement on Your WordPress Website: Displaying the Total Number of Registered Users
If you want to boost user engagement on your WordPress website, one effective strategy is to showcase the total number of registered users. This social proof can encourage others to join your community. In this article, we will discuss two simple methods for displaying the total number of registered users in WordPress.
Method 1: Utilizing the Simple Blog Stats Plugin
To begin, you’ll need to install and activate the Simple Blog Stats plugin. If you’re not familiar with installing WordPress plugins, don’t worry! We have a handy step-by-step guide available. Once the plugin is activated, go to Settings » Simple Blog Stats to configure its settings. This versatile plugin allows you to display various statistics from your WordPress website.
Next, click on the “Shortcodes” tab and locate the “Number of Users” row. Here, you’ll find the shortcode [sbs_users] surrounded by HTML code. You can customize this HTML code according to your preferences.
If you’re unsure about the formatting, simply copy the shortcode [sbs_users] and save the settings. Now you can add this shortcode to any WordPress post, page, or sidebar widget.
To insert the shortcode into a post or page, edit the content and add the “Shortcode” block. Paste the shortcode inside the block settings. Similarly, you can add the shortcode block to display the user count in your sidebar widgets.
To do this, go to Appearance » Widgets and add the shortcode block to the desired location for displaying the user count.
Method 2: Adding Custom Code to Your Theme
If you prefer, you can also add custom code to your WordPress site to display the user count. Before proceeding, make sure to follow our tutorial on how to safely add custom code in WordPress.
Firstly, add the following custom code to your theme’s functions.php file or use the WPCode plugin (recommended):
function user_count_shortcode() {
$user_count = count_users();
return $user_count['total_users'];
}
add_shortcode('user_count', 'user_count_shortcode');
The code above creates a shortcode [user_count] that you can use in your WordPress posts, pages, or sidebar widgets to display the user count. The function does not include any formatting, providing a clean and straightforward output of the user count. However, you can enclose the shortcode with HTML to apply CSS or basic formatting if desired.
Here’s an example:
<p>Join our community of <strong>[user_count]</strong> registered users!</p>
To see how it would appear on your site, take a look at our demo site.
Furthermore, you can enhance user engagement by including a free signup button that directs users to a fully customized WordPress user registration page.
That’s it! By implementing these methods, you can effortlessly showcase the total number of registered users on your WordPress website. For more helpful tips, check out our guide on moderating new user registrations in WordPress. And don’t forget to subscribe to our YouTube Channel for informative WordPress video tutorials. Connect with us on Twitter and Facebook for all the latest updates.