Find out in this tutorial how to display the name of the active theme in the top admin bar of WordPress using code.
To prepare the Genesis Code tutorials and research about new Genesis child themes, or updates to them, I use a local installation (with Flywheel).
But when I make so many changes and modifications in the same installation, sometimes I have doubts about which child theme is active at that moment, especially when I’m in the admin area.
So I looked for a quick and easy way to detect the theme at a glance.
This is the final result:
If you also have a WordPress installation where you test chid theme changes before moving them to production, I’m sure this tutorial will come in handy. 😉
Snippet to display the active theme name in WordPress admin bar
Add the following code at the end of functions.php or in your functionality plugin:
To see this and another 1097 code snippets of this website, login or subscribe here.
Just like that, see?
In this case, you use the admin_bar_menu
hook in combination with the wp_get_theme
function to add the theme name to the top WordPress admin bar.
You also use the priority of “40”, so that it displays right after the site name, but you can change it if you prefer it to appear before or after.
Conclusion
With a few lines of code you can get the active theme name displayed in WordPress admin bar.
Any questions? Let me know in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉