Hiç WordPress sitenizdeki toplam kayıtlı kullanıcı sayısını göstermek istediniz mi?
Sitenizdeki kayıtlı kullanıcı sayısını göstermek gibi sosyal kanıtlar, başkalarını kaydolmaya teşvik eder.
Bu makalede, WordPress’te toplam kayıtlı kullanıcı sayısını nasıl göstereceğinizi göstereceğiz.
Bu yazıda iki yöntemi ele alacağız ve kullanmak istediğinize atlamak için aşağıdaki hızlı bağlantıları kullanabilirsiniz:
Yöntem 1: WordPress Eklentisi Kullanarak Kayıtlı Kullanıcı Sayısını Gösterme
Yapmanız gereken ilk şey Simple Blog Stats eklentisini yüklemek ve etkinleştirmektir. Daha fazla ayrıntı için WordPress eklentisi yükleme hakkındaki adım adım kılavuzumuza bakın.
Etkinleştirmenin ardından, eklenti ayarlarını yapılandırmak için Ayarlar ” Basit Blog İstatistikleri sayfasını ziyaret etmeniz gerekir.
Bu eklenti, WordPress web sitenizden farklı istatistikleri göstermenizi sağlar.
Genişletmek için kısa kodlar sekmesine tıklamanız ve ardından ‘kullanıcı sayısı‘ satırına ilerlemeniz gerekir.
Her iki tarafında iki metin alanı bulunan [sbs_users]
kısa kodunu göreceksiniz. Bu metin alanları HTML içerir ve eklenti kullanıcı sayısından önce ve sonra ekleyecektir.
Varsayılan olarak, kısa kod aşağıdaki gibi HTML çıktısı verecektir:
<span class="sbs-count-users">856</span>
Emin değilseniz, [sbs_users]
kısa kodunu kopyalayın ve ‘Ayarları Kaydet’ düğmesine tıklayın.
Artık bu kısa kodu herhangi bir WordPress gönderisine veya sayfasına ekleyebilirsiniz. Ayrıca bir kenar çubuğu widget‘ına da ekleyebilirsiniz.
Gönderiyi veya sayfayı düzenleyin ve Kısa Kod bloğunu ekleyin. Bundan sonra, kısa kodunuzu kopyalayın ve blok ayarlarının içine yapıştırın.
Benzer şekilde, kısa kod bloğunu kenar çubuğu widget’larına da ekleyebilirsiniz.
Görünüm ” Widget ‘lar sayfasına gidin ve kullanıcı sayısını görüntülemek istediğiniz kısa kod bloğunu ekleyin.
Yöntem 2: WordPress’te Kayıtlı Kullanıcı Sayısını Kodla Manuel Olarak Gösterme
Bu yöntem WordPress sitenize kod eklemenizi gerektirir.
Aşağıdaki özel kodu web sitenize eklemeniz gerekir. Bunu temanızın functions.php dosyasına veya WPCode eklentisini kullanarak ekleyebilirsiniz (önerilir)
Kod ekleme konusunda yardıma ihtiyacınız varsa, WordPress’te özel kodun nasıl güvenli bir şekilde ekleneceğine ilişkin eğitimimizi izleyin:
// 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');
Bu kod, kullanıcı sayısını görüntülemek için WordPress yazılarınızda, sayfalarınızda veya bir kenar çubuğu widget’ında kullanabileceğiniz bir [user_count]
kısa kodu oluşturur.
İşlev, kullanıcı sayısına herhangi bir HTML biçimlendirmesi eklemez ve sadece sayıyı döndürür. CSS veya temel HTML biçimlendirmesini kullanmak için kısa kodu HTML etrafına sarmak isteyebilirsiniz. Örneğin:
<p>Join <strong>[user_count]</strong> other users who share your interests:</p>
İşte demo sitemizde nasıl göründüğü:
Not: Ayrıca özel bir WordPress kullanıcı kayıt sayfasına yönlendiren ücretsiz bir kayıt düğmesi ekledik.
Ek Kaynaklar:
- WordPress için eniyi kullanıcı yönetimi eklentileri – Uzmanlarımız bir WordPress web sitesindeki kullanıcıları yönetmek için en kullanışlı eklentileri seçti.
- WordPress kullanıcı rolleri ve yetenekleri – Web siteniz kullanıcı kaydına açıksa, WordPress’te kullanıcı rollerinin ve izinlerinin nasıl çalıştığını anlamak için bu kılavuzu okumak isteyebilirsiniz.
Hepsi bu kadar. Umarız bu makale WordPress’te toplam kayıtlı kullanıcı sayısını nasıl göstereceğinizi öğrenmenize yardımcı olmuştur. WordPress’te yeni kullanıcı kayıtlarını denetleme hakkındaki kılavuzumuza da göz atmak isteyebilirsiniz.
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.
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
Godson says
Thank a milli for the guide…. Very helpful
WPBeginner Support says
Glad our guide was helpful
Yönetici
papoo says
Hello
thanks for manual method, works fine.
is there a way to add user count in wp REST API?
WPBeginner Support says
You likely could but we don’t have an article on how to do so at the moment.
Yönetici
papoo says
i found a way
add shortcode on a page, then access on json with
wp-json/wp/v2/pages/?slug=”name of the page”
and… search the info
B says
Thanks for the manual code!
Is there any way to display the user count from another WordPress site? I have a public facing website and private “app” that are two different installs and I want to show the app users on the public site.
Angela says
Thanks for this, the code works beautifully!
Chad says
Hey, thanks for this article, its right along the lines of what I am trying to accomplish. Is there a way to only display the subscribers as opposed to the total number of users? I have been scouring the wp codex site but to no avail. I have found a way to populate a list of subscribers but not jsut a total number of them. This would be extremely handy on the website I am building I would love to hear your insight. Thanks again.
Matt says
This might be helpful for you:
// Function to show the user count by role via shortcode
function wpb_user_count($atts) {
$atts = shortcode_atts( array(
‘role’ => ”
), $atts );
$user_query = new WP_User_Query( array( ‘role’ => $atts[‘role’] ) );
// Get the total number of users for the current query. I use (int) only for sanitize.
$result = (int) $user_query->get_total();
return $result;
}
// Creating a shortcode to display user count
add_shortcode(‘user_count’, ‘wpb_user_count’);
// Use this Shortcode to show user [user_count role=”Subscriber”]
Benedikt says
Hey Guys,
found this article and tried both options and both do not work. Usually I am pretty good in this WP stuff …
Could it be that it does not work with certain themes?
It would be great if you could help:
Here is the page:
(We use the Kleo Theme)
Thanks
Benedikt
Benedikt says
Hey Guys,
found this article and tried both options and both do not work. Usually I am pretty good in this WP stuff …
It would be great if you could help
Thanks
Benedikt