PHP code example of hacon / theme-core
1. Go to this page and download the library: Download hacon/theme-core library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hacon / theme-core example snippets
use Hacon\ThemeCore\ThemeModules\ThemeAssetsLoader\ThemeAssetsLoader;
ThemeAssetsLoader::initModule([
'enqueFrontendCSS' => ['assets/css/app.css'],
'enqueFrontendJS' => ['assets/js/app.js'],
'disableDefaultWPAssetsForFrontend' => ['jquery'],
]);
// Reads config/telegram.php → ['botToken' => '...', 'chatId' => '...']
$token = getThemeСonfig('telegram.botToken', '');
// Preferred API
render_component_template('button', '/components/button/button.php', ['class' => 'btn'], ['label' => 'Send']);
// Deprecated — use render_component_template() instead
component('button', ['class' => 'btn'], ['label' => 'Send']);
use Hacon\ThemeCore\Handlers\FormAjaxHandler\FormAjaxHandler;
$handler = new FormAjaxHandler('contact_form');
// configure fields, receivers, templates, redirect...
src/
├── load-functions.php # bootstrap: rface
├── ThemeModules/ # singleton feature modules (ThemeModule base)
├── Services/ # config, templating, telegram, archives, caching
│ └── */shortcuts|helpers/ # global function shortcuts (auto-loaded)
├── Handlers/ # FormAjaxHandler
├── Processors/ # AutoTableOfContentsProcessor
└── Helpers/ # global WordPress + utility functions