Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Display the name of the site manager in WordPress

I need to display the username of the main site administrator for a part of my template.

I have used the following short code to display the email address of the main administrator of the site with which he started WordPress:

<?php bloginfo('admin_email'); ?>

But I did not find any short code to display the username of the main administrator of the site.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Is there such a shortcode or should I get the username of the main administrator of the site in another way?

>Solution :

There is not a shortcode that I know of, but writing one is very simple, and a great exercise to learn shortcode creation:

function admin_email_shortcode() { 
 return bloginfo('admin_email');
}

add_shortcode('admin_email', 'admin_email_shortcode');

Simply add that code to your themes functions.php file and use the shortcode [admin_email] where you want the email address to be displayed.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading