Knowledgebase

MediaWiki Skins Installation and Management

MediaWiki comes preconfigured with a few skins. Skins determine the design of the site. There's one default skin for the whole site. Registered users have the option to select one of the enabled skins to be the default skin for their account. It's used when they are logged in. In addition to the prepackaged skins, you can install other skins, you can enable/disable installed skins, and you can also hide enabled skins from the account settings of registered users so that they can't be selected.

In this article we'll briefly go over these basic tasks related to managing skins. For some more details you can also check out the tutorial on how to install and manage skins in MediaWiki.

Install Skins

To install a skin you need to do the following:

The files of the skin are packed into an archive so you can first unpack it on your local computer and then upload the unpacked content, or your can upload the archive and unpack it on the account. You have to put the skin's files in subfolder of the /skins directory. So, for example, if your MediaWiki is installed in the public_html directory on your hosting account, the skin's files should be located in public_html/skins/name-of-skin (replace name-of-skin with the actual name of the skin).

Enable and Disable Skins

In order for an installed skin to be used it has to be enabled. You can do this by inserting a line of code in the LocalSettings.php file of your MediaWiki. The file is in root MediaWiki folder on your hosting account. Put the following on a new line at the end of the file (or below the lines of the other enabled themes):

require_once "$IP/skins/name-of-skin/name-of-skin.php";

In the place of name-of-skin put the name of the skin. You can check its name in the /skins directory of your MediaWiki. In the folder of the skin you'll also find the main PHP file of the skin; it has the same name as the skin with the .php extension at the end.

To disable a skin either delete its corresponding line in LocalSettings.php or put # in front of the line to comment it out.

Change the Default Skin of the Site

The default skin is first set during the installation of MediaWiki. After that you can change it at any time with any of the enabled skins. You can do this by modifying the following line in the LocalSettings.php file of your MediaWiki:

$wgDefaultSkin = "name-of-skin";

Replace name-of-skin with the name of the skin that you want to make the default one.

Skin Options in User Preferences

By default, registered users can select one of the enabled skins to be their default skin. It will be used when they are logged in. They can select it from the user account options: Preferences button in the top right corner>Appearance tab on the page that opens>Skin option. They have to mark the radio button of the skin and click on the Save button.

Prevent Users from Selecting Certain Skins

If you want to test a new skin but you don't want to make it accessible to registered users, you can hide that skin from being displayed in the options for user preferences. To do this, put the following line at the end of the LocalSettings.php file of your MediaWiki:

$wgSkipSkins = array( 'name-of-skin' );

In the place of name-of-skin put the actual name of the skin. You can list more than one skin; separate the names with a comma. The listed skin(s) will still be enabled and you can preview it by adding useskin=name-of-skin to the URL of the site. For example, if the main URL of the site is yourdomain.com and the name of the skin is vector you have to open the URL yourdomain.com/index.php?useskin=vector.

For some more details you can also check out our MediaWiki skins tutorial.

Was this answer helpful?

 Print this Article

Also Read