Setup
Theme Configuration
All theme setup is handled in the functions.php
file.
TailPress will automatically:
- Enqueue your theme assets, fully compatible with Vite.
- Register common WordPress theme features.
- Set up a primary navigation menu.
Loading Translation Files
To load a translation file, you can use the withTextdomain
method:
1withTextdomain('your-textdomain');
You may also pass a second argument to specify a custom path. By default, TailPress will look in the /languages
directory.
Full Example
Here's a complete example of how to configure your TailPress theme:
1function tailpress(): TailPress\Framework\Theme
2{
3 return TailPress\Framework\Theme::instance()
4 ->assets(fn($manager) => $manager
5 ->withCompiler(new TailPress\Framework\Assets\ViteCompiler, fn($compiler) => $compiler
6 ->registerAsset('resources/css/app.css')
7 ->registerAsset('resources/js/app.js')
8 ->editorStyleFile('resources/css/editor-style.css')
9 )
10 ->enqueueAssets()
11 )
12 ->features(fn($manager) => $manager
13 ->add(TailPress\Framework\Features\MenuOptions::class)
14 )
15 ->menus(fn($manager) => $manager
16 ->add('primary', __('Primary Menu', 'tailpress'))
17 )
18 ->themeSupport(fn($manager) => $manager->add([
19 'title-tag',
20 'custom-logo',
21 'post-thumbnails',
22 'align-wide',
23 'wp-block-styles',
24 'responsive-embeds',
25 'html5' => [
26 'search-form',
27 'comment-form',
28 'comment-list',
29 'gallery',
30 'caption',
31 ],
32 ]));
33}
34
35tailpress();