Created by Casper Panduro aka Code by Panduro
- Install dependencies:
composer install
- Setup frontend url in
wp-config.php
asdefine('WP_FRONTEND_URL', 'http://localhost:3000');
. Default ishttp://localhost:3000
.
Before you get started, make sure to include the necessary files at the beginning of functions.php
:
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/app/theme.php';
To set up your theme, the functions.php
file utilizes the after_setup_theme
action. It initiates the theme setup and performs specific tasks like removing user roles and adding menus.
add_action('after_setup_theme', function() {
theme()
->headlessSetup()
->removeUserRoles(['subscriber', 'contributor', 'author', 'editor'])
->addMenu('main', 'Main Menu');
});
To add your own custom functions, extend the file located at /app/CodeByPanduro/Theme/Setup.php
.
The init
action helps you to register new custom post types.
add_action('init', function() {
post_type()
->add('book')
->register();
});
You can add your own custom post types here.
Custom REST API endpoints can be registered using the rest_api_init
action.
add_action('rest_api_init', function () {
rest_api()->menu();
});
For contributing to this functions.php
, please ensure to follow the coding standards and guidelines outlined for the project.