Core concepts
Registry API
The registry is the public entry point for every framework definition.
#Where does $registry come from?
You do not create $registry. Voxycure creates one shared Registry object and passes it as the first argument when the voxycure/register WordPress action runs.
<?php
use Voxyframe\Core\Registry;
add_action('voxycure/register', function (Registry $registry): void {
// $registry is available only inside this callback.
$registry->register_post_type('project', [
'name' => 'Projects',
]);
});#Load the callback from a theme
Create inc/voxycure.php in the active theme and require it once from functions.php. WordPress loads functions.php automatically; that file loads your definitions.
// functions.php
defined('ABSPATH') || exit;
require_once get_theme_file_path('inc/voxycure.php');If Voxycure is inactive, the action is never fired and the callback does nothing. The theme must not call new Registry().
#Available methods
| Method | Purpose |
|---|---|
register_post_type($slug, $definition) | Register a WordPress post type. |
register_taxonomy($slug, $definition) | Register a taxonomy and connect post types. |
register_block($id, $definition) | Register a dynamic PHP block. |
register_field_group($id, $definition) | Attach fields to WordPress documents or a supported integration such as WooCommerce products. |
register_option_page($slug, $definition) | Create a code-defined settings screen. |
#Organize a larger project
your-theme/
├── functions.php
├── inc/
│ ├── voxycure.php
│ └── voxycure/
│ ├── post-types.php
│ ├── taxonomies.php
│ ├── fields.php
│ ├── blocks.php
│ └── options.php
└── blocks/
└── hero/
├── render.php
└── style.css#Official WordPress reference
WordPress: add_action() explains how callbacks receive values passed by an action. WordPress: get_theme_file_path() explains child-theme-aware file paths.