Skip to main content

Installation

Stability

WordPress Neon is current in active development and no stable version has been released. Due to this, everything in the documentation might be subject to breaking changes before version 1.0 is released.

Install with Composer

composer require wpn/framework

Including Composer Dependencies in WordPress

functions.php
<?php

require_once __DIR__ . '/vendor/autoload.php';

Create the Application Service Provider

As outlined in WordPress' theme basics the App service provider should be placed in the inc directory of your theme root directory. Which should be included using PSR-4.

App/AppServiceProvider.php
<?php

namespace App;

use WPN\App;
use WPN\Providers\ServiceProvider;
use WPN\Assets\GoogleFont;
use WPN\Assets\Script;
use WPN\Assets\Style;

class AppServiceProvider extends ServiceProvider
{
protected function boot(App $app)
{
$app->init(__DIR__.'/config.php');

GoogleFont::load('lato', 'https://fonts.googleapis.com/css?family=Lato');

Style::load('css/app.css');

Script::load('js/app.js')
->localize('theme', [...Script::ajaxData()]);
}
}

By default, we are loading Lato from Google Fonts using their API, enqueuing the theme assets app.css and app.js from their respective directories.

We also provide the Application with a route to our config file which we will create next.

Config File

The application's config file is used during the boot method of WordPress Neon to register its plugins and enable/disable some features that may not be required in some themes.

app/config.php
<?php

use WPN\Plugins\Mailhog;
use WPN\Plugins\Theme\FooterMenu;
use WPN\Plugins\Theme\HeaderMenu;

return [
'plugins' => [
Mailhog::class,
],
'features' => [
FooterMenu::class,
HeaderMenu::class
],
'template_path' => 'template-parts',
'asset_path' => 'assets'
];

In this config file we have registered the use of the MailHog plugin and enabled the Header and Footer menu features which will register two menus with WordPress for the respective location of our theme.

Getting Started With the Starter Theme

info

The WordPress Neon starter theme is currently in development, check https://github.com/WordPress-Neon/starter-theme for development progress