Admin-side themes

The steps for creating and using admin-side themes is still the same as they were prior to Textpattern 4.7.

You could create an admin-side theme from scratch, but we strongly recommend you create one by duplicating an existing core theme instead then modifiy your copy as desired, especially if it’s your first admin-side theme attempt.

Core themes are maintained and reflect the latest markup per stable release of Textpattern, thus by duplicating a core theme you ensure your own theme markup is current too.

Duplicating and modifying a core theme

Step 1:

In your Textpattern installation, browse the /textpattern/admin-themes directory. You’ll see three core theme directories already there:

  • classic
  • hive
  • hiveneutral

A given admin-side theme directory has the following contents:

  • assets (directory)
    • css (directory for stylesheet files)
    • img (directory for image files)
    • js (directory for JavaScript files)
  • themename.php (where file name is the theme directory name)
  • manifest.json
  • ReadMe.txt
  • screenshot.png (screenshot of the theme)

The child directories of the assets directory may vary, but it will likely include the css and img directories at the very least. You may not even use images in your own theme, in which case you could remove that directory too.

Step 2:

Pick one of the core theme directories and duplicate it by whatever method you prefer. Often there is a Duplicate feature in your file manager’s right menu options. Using that will provide you with a duplicate directory called theme copy. So if you duplicated the classic theme directory, you’d have classic copy.

Step 3:

Rename your copy directory to whatever theme name you want, but don’t try to be overly clever. The name must not have any blank spaces, and hyphens should be the only non-alphanumeric character. For example:

  • mytheme
  • my-theme

Whatever you rename your duplicated directory, use the same name to rename the .php file inside of it (e.g. mytheme.php).

Leave all other directory and file names alone. You will simply edit their contents, if necessary, not their names.

You can delete the screenshot.png file or replace it with your own theme image later. Whatever.

Step 4:

Log in to the admin-side of the Textpattern site and go to Admin > Preferences > Admin, look for the “Admin-side theme” preference and use the select menu to change to your newly duplicated theme by the new name (step 3).

Step 5:

Now, as you normally would when designing a website presentation, edit your new theme files as you desire.

By having selected the theme in step 4, you easily see the changes reflected in the admin-side as you work.

Also, by keeping everything contained in the theme directory, you can easily switch back to one of the core themes should you need a break from your own lovely work. ;)

Future admin-side themes

In the future, if you create another admin-side theme, you can duplicate your own initial theme, or really start from scratch (a blank slate). Either way, you’ll be better informed to succeed having initially understood the process from a core example.

Resources for the deep-divers

If you’d like to really study the Classic or Hive themes, the following resources are available:

See something wrong in this document? Outdated info, a broken link, faulty code example, or whatever? Please write an issue and we’ll fix it.