How to install drupal themes

Before visitors to your site will see the pages displayed using a theme the theme needs to be installed and set as the default.

This is a very common issue, and for a long time I really didn’t know how to go about solving it. It was just too difficult. The problem is that, if you are using drupal as your CMS, you probably don’t have the necessary permissions to install themes from the admin pages (because they are not accessible from the admin dashboard). To make matters worse, this is not just an issue for Drupal themes. It also affects other popular content management systems.

In Drupal 7 there was a fix for this problem in the form of the “Theme Update” module. Unfortunately it did not work in Drupal 8 and was completely broken in Drupal 9 (as far as I know), so some folks have had to resort to other solutions. 

Installing a custom theme

First, here are some quick tips on how to install a Drupal theme.

Themes for Drupal 8 themes

Drupal is a web CMS built on top of the open source X theme engine. The X engine is an interpreted programming language that allows you to build upon existing themes or create your own. Many Drupal themes are available in different formats: HTML, CSS and PHP scripts, templates and modules (themes).

This may sound like a simple process but installing a custom theme can be trickier than you think. There are several steps to follow if you wish to install your own custom theme:

1. Install Drupal 8 or 7 with the default settings (this gives you the fastest installation time)

2. Download and unzip the file containing all of your customizations into your web root folder (e.g., C:\Documents and Settings\user-name\Appdata\roaming\drupal8\install_files ) (you can rename this in Windows)

3. Ensure that all files are added to your WordPress installation folder (e.g., C:\Documents and Settings\user-name \Appdata\Roaming\drupal8\)

4. Activate any installed plugins which will be overwritten by your customizations since they will also be activated automatically when you install new themes in Drupal 8 (/includes/core/core-plugins/core-plugins-loaded/load-plugins)

5. Delete any old customizations files from /includes/customize/theme_manager so that they don’t interfere with upgrading new themes to Drupal 8 or 7

Setting a custom theme as default

There are two ways to set a custom theme as the default on your Drupal site. The first is to add the following line to your drupal_config.php file:

-module(‘drupal_default_theme’)

The second, and more common way, is to use the following code in your functions.php file (just before drupal_preload_theme()):

function drupal_preload_theme() { register_globals(array( ‘$default’, ‘drupal_default_theme’ )); }

If you are using Drupal 7, you can use the following code instead of drupal_preload_theme(), which is also available for Drupal 6 (but only in PHP 5.6+)

function dorusConfigureThemes() { register_globals(array( ‘$default’, ‘dorusConfigureThemes’ )); return; } dorusConfigureThemes(); // // turn off default theme and load custom submodules $ default = array(); $ default [ ‘drupal’ ] = array( ‘theme’ => NULL ); if ( ! function ( ) { } // // load custom theme function function rusFolders ( ) { if ( ! function ( ) { } wpautopages . registerTextareaElement( new WPautopages::ThemeRootPanel (), false , 0 , 0 , 1 ); } rusFolders (); } wpautopages . registerTextareaElement( new WPautopages::ThemeRootPanel (), false , 0 , 0 , 1 );

// // set default theme for unstyled pages $ default [ ‘drupal’ ] = array( ‘theme’ => NULL ); wpautopages . registerTextareaElement( new WPautopages::ThemeRootPanel (), false , 0 , 0 , 1 ); wpautopages . registerDisabledTextareaElement( new WPautopages::ThemeRootPanel (), true , 2 , 0 , 4 ); rusFolders () // // set default theme for styled pages $ default [ ‘drupal’ ] = array( ‘theme’ => NULL ); wpautopages . registerDisabledTextareaElement( new WPautopages::ThemeRootPanel (), true , 2 , 0 , 4 ); rusFolds ()

Conclusion

Drupal themes are a great way to build a functional and visually appealing website at little or no cost. They can be installed with minimal effort by anyone with basic coding skills. And they have been around for years and have been well tested, so there’s no reason why you shouldn’t pick one up yourself.

The quickest way to install them is through Drupal’s built-in theme manager, but there are several other ways to get started too. First, you need to make sure that the theme is available on your site through the administration panel (you can find it in your Drupal installation directory under /sites/all/themes/). Then, if that isn’t enough, you need to add the theme to the configuration of your site.

Open up your theme configuration page (usually located in http://yourdomainname/configure). You should see a section called ‘default’. Copy this line:

and past it into your web host’s root folder (c:\drupal1\site_root\); other locations may also work, depending on what kind of hosting you have. The only thing that needs changing here is adding the new line ‘copyright’ which will override any copyright notice from Drupal itself (which is used if you want to use third party themes). Note that this should be changed only if you want to publish the theme for others; for example, for commercial reasons (website templates), or for personal use (public spaces such as blogs and forums). Once done, restart your site; if all goes well you should see the new page displayed in its default location at http://yourdomainname/default/ .

Note that this change does not affect any site-wide settings; it applies only to specific pages within your site. If you want to apply a custom menu or style using custom CSS selectors then this must be done individually on each page in turn. Finally, remember that in order for themes installed with drupal_add_theme() function on admin panel pages such as global menu node and post types menu entry these must also be added to theme’s config file so they won’t appear as plugins when using them directly from admin panel.