Theme
Chevereto ships with the Peafowl theme, a PHP theme located at content/legacy/themes/Peafowl/. You can customize it at different levels, from dashboard settings to a full theme clone, without editing the core files.
| Method | Use it for | Survives upgrades |
|---|---|---|
| Dashboard settings | Palette, font, custom CSS and JS | Yes |
| Custom hooks | Add code at fixed spots in every page | Yes |
| Theme overrides | Replace any theme file with your own version | Yes |
| Clone theme | Build your own theme from Peafowl | Yes, but no fixes |
Theme structure
| Path | Contents |
|---|---|
views/ | Page views, one per route (image.php, user.php, ...) |
snippets/ | Partials used by views (forms, modals, listings, inline JS) |
tpl_list_item/ | Templates for items in listings (images, albums) |
mails/ | Email templates |
head.php | The <head> of every page |
header.php | Loads head.php and opens <body> |
footer.php | Closes the page and loads the JavaScript |
functions.php | Theme functions, loaded before the view |
style.css | Theme styles (style.min.css is the file loaded) |
lib/ | Peafowl CSS, Chevereto JS bundle, Font Awesome |
custom_hooks/ | Custom hooks |
overrides/ | Theme overrides |
Dashboard settings
/dashboard/settings/theme
Before touching any file, check what can be done from the dashboard:
- Theme: The active theme, any folder in
content/legacy/themes/. - Default palette: The color scheme. Users can also pick their own if Enable user palette selection is on.
- Default font: The font family.
- Custom CSS code: Added as a
<style>tag inside<head>. - Custom JS code: Added as a
<script>tag inside<head>.
Settings are stored in the database, so they are kept across upgrades and Docker rebuilds.
Palettes
The <html> element gets the palette-<name> class and a data-palette attribute for the active palette. The available palettes are system, blanco (Light), dark, flickr, imgur, deviantart, lush, graffiti, abstract, cheers and cmyk.
Colors are defined as CSS variables. The light palette defines them on :root and the other palettes redefine them with .palette-<name>:root (see snippets/theme_colors.css.php). To change the accent color of the light palette:
:root {
--colorAccent: #e91e63;
--colorAccentStrong: #c2185b;
}To change a specific palette, use its selector:
.palette-dark:root {
--linkText: #ff80ab;
--buttonAccentBackground: #e91e63;
}Add this CSS in Custom CSS code or in the style.css hook.
Custom hooks
content/legacy/themes/Peafowl/custom_hooks/
Custom hooks let you add code at fixed spots of the theme. Chevereto loads a hook when its file exists, and skips it otherwise.
Each hook ships as a .sample file. To enable a hook, copy the sample removing .sample from its name and edit the copy. For example, copy head.sample.php to head.php.
| File | Where it goes |
|---|---|
head_open.php | Right after <head> |
head.php | Right before </head>, after all the theme styles |
head_after.php | Right after </head> |
header.php | After head_after.php, before <body>. Useful for PHP logic |
body_open.php | Right after <body> |
footer.php | In the footer, before the Chevereto JavaScript is loaded |
share_links.php | Defines the share buttons |
style.css | Linked as a stylesheet after the theme styles and Custom CSS |
The body_open.php hook also runs on the pages that don't use the theme header, like login, signup and account pages.
For example, to add a verification meta tag create custom_hooks/head.php:
<?php
// @phpstan-ignore-next-line
if (!defined('ACCESS') || !ACCESS) {
die('This file cannot be directly accessed.');
}
?>
<meta name="example-site-verification" content="your-token">Hooks run in the theme context, so you can use the same functions and variables available in the views, like Handler::var() and getSetting().
Direct access guard
Keep the ACCESS check at the top of your PHP hooks. It prevents the file from running if it's requested directly by URL.
Errors are silenced
Errors in PHP hooks are caught and ignored, so a broken hook won't break your website, but it won't show anything either. If a hook doesn't work, check it for syntax errors with php -l.
Share links
The share_links.php hook replaces the list of share buttons. Copy share_links.sample.php to share_links.php and edit the $share_links_networks array:
<?php
global $share_links_networks;
$share_links_networks = [
'mail' => [
'url' => 'mailto:?subject=%TITLE%&body=%URL%',
'label' => 'Email',
],
'bluesky' => [
'url' => 'https://bsky.app/intent/compose?text=%TITLE%%20%URL%',
'label' => 'Bluesky',
],
'whatsapp' => [
'url' => 'whatsapp://send?text=%TITLE%%20%URL%',
'label' => 'WhatsApp',
'mobileonly' => true,
],
];| Key | Description |
|---|---|
| array key | Network name, also used as the Font Awesome brand icon (fa-<key>) |
url | Share URL, with placeholders |
label | Button tooltip |
icon | Optional icon name, if it differs from the key |
mobileonly | Optional, show the button only on phones |
Placeholders are replaced with the URL-encoded values of the shared content: %URL%, %TITLE%, %DESCRIPTION%, %IMAGE%, %HTML% and %TWITTER% (the X account in settings).
The list you define replaces the default one entirely, so include every network you want to show. Share buttons only show when Enable social share is on in the theme settings.
Theme overrides
content/legacy/themes/Peafowl/overrides/
Theme overrides replace a theme file with your own version. Chevereto checks the overrides/ folder first and uses your file instead of the original one.
Overrides follow the same structure as the theme. To override a file, copy it to the same relative path inside overrides/ and edit the copy:
| Original file | Override file |
|---|---|
views/image.php | overrides/views/image.php |
snippets/modal_share.php | overrides/snippets/modal_share.php |
tpl_list_item/image.php | overrides/tpl_list_item/image.php |
mails/account-welcome.php | overrides/mails/account-welcome.php |
header.php | overrides/header.php |
functions.php | overrides/functions.php |
style.min.css | overrides/style.min.css |
lib/peafowl.min.css | overrides/lib/peafowl.min.css |
lib/chevereto-all.min.js | overrides/lib/chevereto-all.min.js |
For example, to customize the image page copy views/image.php to overrides/views/image.php and edit it. Chevereto now uses your file to render the image page. To restore the default, delete the override.
Overrides also work for files that don't exist in the theme. A custom route named hello renders overrides/views/hello.php.
Overriding hooks
PHP hooks can also be placed at overrides/custom_hooks/, so you can keep all your changes in the overrides/ folder. The exception is style.css, which must be at custom_hooks/style.css.
Built files
The browser loads the minified style.min.css, lib/peafowl.min.css and lib/chevereto-all.min.js. Overriding the source files (style.css, lib/js/chevereto.js) has no effect, override the minified file instead.
Clone theme
If you need deeper changes you can clone Peafowl into a new theme:
- Copy
content/legacy/themes/Peafowl/tocontent/legacy/themes/MyTheme/. The folder name can only contain letters, numbers,-,_and.. - Go to
/dashboard/settings/themeand selectMyThemein Theme.
If the configured theme folder doesn't exist, Chevereto falls back to Peafowl.
The lib/ assets (Peafowl CSS, Chevereto JS and Font Awesome) are always loaded from Peafowl/lib/, even when using a cloned theme. To change them, use overrides/lib/ in your theme.
Clones don't get updates
When you upgrade Chevereto only Peafowl gets updated. A cloned theme keeps the old views, which may not work with the new version. Prefer overrides for most customizations and clone only when you need to change most of the theme.
Upgrades
Upgrading Chevereto replaces the files that ship with it and keeps the rest. Your custom hooks, overrides and cloned themes are kept, but the original files you copied from may change.
To keep track of these changes, create a git repository with the Chevereto files and commit each new version. Use git diff between versions to see what changed in the files you have overridden, and merge those changes into your copies.
Docker
In Docker the application lives at /var/www/html and the files are replaced when you rebuild the image. Mount your customizations so they survive rebuilds:
volumes:
- ./theme-overrides:/var/www/html/content/legacy/themes/Peafowl/overrides
- ./style.css:/var/www/html/content/legacy/themes/Peafowl/custom_hooks/style.cssPlace your PHP hooks at ./theme-overrides/custom_hooks/ to load them from the overrides mount.
