How To Rename a Theme

September 13, 2012 10:47 am 0

Although the themes usually counts dozens of files with megabytes of code, it’s not to complicated to rename WordPress theme. In this tutorial, we will guide you what you should do to rename any of our themes, if you need to.

Renaming the themes is not something that’s absolutely necessary because visitors of your site usually don’t see the name of the theme that you are using. However, if you are working for a (demanding) client, he might want to name the theme like his company or website name. Here are several basic steps that you should make to rename a WordPress theme. Please keep in mind that, since every theme contains many files, the traces of the old theme’s name could be left here and there. However, the most important thing, name of the theme in WordPress dashboard will be changed for good!

First of all, make a backup copy of your site and database, so you can revert it back if something unwanted happens.

All themes are located in /WP_ROOT/wp-content/themes (WP_ROOT is the root folder of your WordPress installation). Make a copy of the entire theme folder and rename the theme folder (in example, from ‘hot_destinations’ to ‘my_theme’). If there’s readme.txt file available in the theme, open it and change the line ‘Theme Name: hot_destinations’ to ‘Theme Name: my_theme’. Do the same for file style.css (it must be present for every theme). Beside the name, you can edit the theme description if you need to.

The next file you should edit inside the theme’s folder is globals.php. In this file, you should edit these two lines:

$HWPT_LANGUAGE = 'hot_destinations';
$PARM_PREFIX = 'destinations_';

Change them to this:

$HWPT_LANGUAGE = 'my_theme';
$PARM_PREFIX = 'my_theme_';

The next file to edit is functions.php. You will see this line in the beginning of this file:

$themename = "HOT Destinations";

Simply change it to your new name:

$themename = "My Theme";

In file functions.php and also in some other theme files, you will find many text domains usually set to the theme name value or varable $HWPT_LANGUAGE. Feel free to change it to your new theme name if necessary.

"desc" => __("Theme Layout",$HWPT_LANGUAGE),
"desc" => __("Theme Layout","Hot Destinations"),

You can change such text domains in these lines to the text that you prefer.

"desc" => __("Theme Layout","My Theme"),

Per my opinion, it’s not necessary to dig too deep into the theme files and trying to remove all traces of the old theme name. However, if you have a good reason to do that, please be carefull and always make backups. After each change, you should check the functionality of your site. If you make a hundred changes and find out then that your site is not functional, you would not know what change made the problem.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.