From nothing to your own MyBB 1.8 theme: copy MyStudio Default or start from scratch, override templates, add CSS and JavaScript, add settings and share it as one ZIP. No PHP needed for a basic theme.
- Pick an approach (a child theme is usually right)
- Templates are files named like MyBB's; new files need a full sync
- Export a package to share it
Pick an approach
| Approach | Best for |
|---|---|
| Child theme | Changing parts of an existing theme while it keeps getting updates. Usually the right choice. |
| Copy MyStudio Default | A complete theme of your own that no longer follows updates. |
| From scratch | Full control: start with a stylesheet and override templates one by one. |
Copy MyStudio Default
- Copy
themes/mystudio-default/tothemes/my-theme/. Lowercase letters, numbers and hyphens: the folder name is the theme's slug. - Open
themes/my-theme/theme.jsonand give it a newname. Names must be unique: MyStudio tells themes apart by name. - For the sidebar, logo, strings and settings form, also copy
inc/plugins/mystudio/themes/mystudio-default/toinc/plugins/mystudio/themes/my-theme/, and give its functions your own prefix. - On MyStudio → Themes, click Sync to Database on your theme, then Set as Default.
- Open the forum and press Ctrl+Shift+R.
Start from scratch
MyBB fills in every template you don't provide with its default, so you can start very small:
themes/my-theme/
├── theme.json
└── css/
└── global.css
{
"name": "My Theme",
"version": "1839",
"stylesheets": [
{ "name": "global.css", "attachedto": "", "order": 1 }
]
}
body { background: #0f172a; color: #e2e8f0; font-family: system-ui, sans-serif; }
a { color: #2dd4bf; }
Sync and set it as default. Your forum now uses MyBB's standard templates with your CSS.
Override templates
Create a file named exactly like the MyBB template, for example themes/my-theme/templates/footer/footer.html. Copy the original from Templates & Style → Templates or from MyStudio Default, change it, and run a full sync (new files always need one).
Keep MyBB's own pieces when you override footer: {$task_image} (runs scheduled tasks), {$auto_dst_detection}, <debugstuff>, {$contact_us} and {$showteamlink}. Without them parts of the forum quietly stop working.
Add JavaScript
Put scripts in themes/my-theme/js/ and load them in a template, usually headerinclude:
<script src="{$mybb->asset_url}/themes/my-theme/js/my-theme.js?v={$mybb->ms_asset_v}"></script>
Keep ?v={$mybb->ms_asset_v} on your CSS and JS links: MyStudio fills it with the time of your last change, so browsers fetch new files instead of cached ones.
Add a screenshot
Put a screenshot.jpg (or PNG or WebP) of the forum index at 1280 × 800 in the theme folder. The Themes page shows it on the card and in a lightbox. A child theme without one shows its parent's.
Give it settings and PHP
- Settings: define them in
inc/plugins/mystudio/themes/my-theme/options.phpand read them in templates as{$mybb->ms_theme_options['key']}. See the options schema. - PHP: add template variables from
inc/plugins/mystudio/themes/my-theme/hooks.phpwith MyBB hooks:
<?php
if (!defined('IN_MYBB')) {
die('Direct initialization of this file is not allowed.');
}
global $plugins;
$plugins->add_hook('index_start', 'mytheme_index_greeting');
function mytheme_index_greeting()
{
global $mybb, $mytheme_greeting;
$name = $mybb->user['uid'] ? htmlspecialchars_uni($mybb->user['username']) : 'guest';
$mytheme_greeting = "Hello, {$name}!";
}
Then use {$mytheme_greeting} in the index template. Escape anything a user typed with htmlspecialchars_uni().
Support MyStudio's modules and options
- List the modules your theme supports in
theme.json"modules". - Declare which layout choices you handle in
"supports"; the Admin CP then offers only those. - Keep the modules' hook points in your templates:
ficons_{$forum['fid']}for Forum Icons,{$post['button_like']}for likes,{$ms_alerts_header}for the alerts bell,{$banner_style}for profile banners and so on. - Use the
--ms-*CSS variables (--ms-accent,--ms-border,--ms-surface,--ms-muted…) so modules match your colours.
Details in the theme.json reference. The easiest start is a copy of MyStudio Default, which handles all of it.
Share it as a package
MyStudio → Themes → Export Package downloads the theme with its PHP, settings schema and modules as one ZIP. Others import it with a review screen. See import and export.
Troubleshooting
| Problem | Fix |
|---|---|
| My change doesn't show | Sync, then reload with Ctrl+Shift+R. |
| My new template is ignored | New files need a full sync; check the file name matches the template name exactly. |
| A second copy of my theme appeared | You changed name in theme.json: a new name is a new theme. |
| My CSS file isn't loading | List it under stylesheets in theme.json and sync. |
| "Failed the MyBB template security check" | The template contains syntax that could run PHP, such as {${…}}. Move logic to hooks.php. |
A setting shows as {$mybb->ms_theme_options[…]} | The key is misspelt, or options.php isn't in inc/plugins/mystudio/themes/{slug}/. |