Getting started
Build your first project feature
Register a post type, attach structured fields, and read the saved values in a theme template.
#1. Register the post type and fields
Place this complete code in inc/voxycure.php, then load that file from the theme’s functions.php.
<?php
defined('ABSPATH') || exit;
use Voxyframe\Core\Registry;
add_action('voxycure/register', function (Registry $registry): void {
$registry->register_post_type('project', [
'name' => 'Projects',
'singular_name' => 'Project',
'show_in_rest' => true,
'supports' => ['title', 'editor', 'thumbnail'],
]);
$registry->register_field_group('project-details', [
'name' => 'Project details',
'post_types' => ['project'],
'fields' => [
['field_key' => 'client_name', 'label' => 'Client', 'type' => 'text'],
['field_key' => 'launch_date', 'label' => 'Launch date', 'type' => 'date'],
],
]);
});#2. Edit and save
Create a Project in WordPress. The document settings panel is loaded only in the block editor and only for the targeted post type. Saving the post sends the registered meta through the WordPress REST API.
#3. Render the values
<p class="project-client">
<?= esc_html(voxycure_get_field('client_name')) ?>
</p>