থিম
এই অধ্যায়টি এখনও অনুবাদ হয়নি, তাই ইংরেজিতে দেখানো হচ্ছে।
A theme changes how the public site looks. The admin panel stays the same whichever theme is active.
Installing and switching
Admin → Themes.
- Upload a theme takes a ZIP with
theme.jsonat its root or inside one folder. A theme with the same code is replaced and keeps its options. - Preview shows the theme to you alone, on the public site, until you press Stop preview. Members keep seeing the active theme.
- Activate makes it the theme of the site.
- Options opens the settings the theme offers. Reset to defaults puts them back.
- Delete removes a theme from the server. The base theme and the active theme cannot be removed.
The default theme
MeetBook ships with the script: clean cards, light and dark modes, built for phones first. Its options are the roundness of corners, the width of the feed, and a white or brand-coloured top bar.
The brand colour, the logo and the default mode are not theme options. They are set once on Admin → Logo & colours and every theme uses them.
Light and dark
Each member chooses light or dark from the avatar menu, and the choice is remembered. The default for new visitors is set on Admin → Logo & colours.
Making your own theme
The quickest start is a child theme: it holds only what you change.
- Copy
themes/meetbookto a new folder, for examplethemes/sunrise. - In
theme.jsonchangecodeandname, and add"extends": "meetbook". - Delete every file you do not want to change.
themes/sunrise/
theme.json name, code, version, author, description, extends, options
screenshot.png shown on the Themes page
style.css loaded after the styles of the parent theme
script.js loaded after the scripts of the parent theme
functions.php PHP that runs on every page: hooks and filters
layouts/ main.php, auth.php - the frames around a page
pages/ one file per page: home.php, profile.php, post.php, search.php ...
parts/ pieces used by pages: topbar.php, post.php, comment.php, user-card.php ...
settings/ the tabs of the member's Settings page
plugins/<code>/ your own version of a plugin's view files
A template is looked for in the active theme first, then in the theme it extends, then in the script's own templates/ folder. Copy a file from templates/ into your theme with the same folder and name, and your copy is used.
theme.json
{
"name": "Sunrise",
"code": "sunrise",
"version": "1.0.0",
"author": "You",
"description": "A warm look.",
"extends": "meetbook",
"options": {
"accent": {"type": "color", "label": "Accent colour", "default": "#ff7a18"},
"wide": {"type": "toggle", "label": "Wide layout", "default": "0"},
"font": {"type": "select", "label": "Font", "default": "system",
"choices": {"system": "System", "serif": "Serif"}}
}
}
Option types are text, textarea, number, color, toggle and select. Read an option in PHP with theme_option('accent', '#ff7a18'). Colour options are also available in CSS as --theme-<key>, for example var(--theme-accent).
Rules
- A theme must never edit files outside its own folder.
- Use the CSS variables of the design system (
--brand,--bg,--card,--ink,--muted,--line,--radius) so the brand colour and dark mode keep working. - Escape everything you print with
e(). - Keep
defined('MMB_VERSION') or exit;at the top of every PHP file.
To sell or share a theme, zip its folder. The ZIP installs on any MyMeetBook site from Admin → Themes → Upload a theme.