/wpemerge-theme

An organized, ES6 and SASS powered theme taking advantage of the WP Emerge framework. ๐Ÿš€

Primary LanguagePHPGNU General Public License v2.0GPL-2.0

WP Emerge Theme Logo

Packagist Travis branch Gitter

A modern WordPress starter theme which uses the WP Emerge framework.

This is the WP Emerge Theme project - for the WP Emerge framework please check out https://github.com/htmlburger/wpemerge.

Summary

Documentation

http://docs.wpemerge.com/#/starter-theme/overview

http://docs.wpemerge.com/#/starter-theme/quickstart

Development Team

Brought to you by Atanas Angelov and the lovely folks at htmlBurger.

Comparison Table

WP Emerge Theme Sage Timber
View Engine PHP, Blade, Twig, any PHP, Blade Twig
Routing โœ” โœ– โœ”
WP Admin Routing โœ” โœ– โœ–
WP AJAX Routing โœ” โœ– โœ–
MVC โœ–โœ”โœ” โœ–โœ”โœ–ยน โœ–โœ”โœ–
Middleware โœ” โœ– โœ–
View Composers โœ” โœ”/โœ–ยฒ โœ–
Service Container โœ” โœ” โœ–
Stylesheets SASS + PostCSS SASS + PostCSS N/Aยณ
JavaScript ES6 ES6 N/Aยณ
Front end, Admin, Editor and Login Bundles โœ”โœ”โœ”โœ” โœ”โœ–โœ–โœ– N/Aยณ
Automatic Sprite Generation โœ” โœ– N/Aยณ
Automatic Cache Busting โœ” โœ– โœ–
WPCS Linting โœ” โœ– โœ–
Advanced Error Reporting โœ” โœ– โœ–
WP Unit Tests for your classes โœ” โœ– โœ–

ยน Sage's Controller is more of a View Composer than a Controller.

ยฒ Sage's Controller provides similar functionality but is limited to 1 composer (controller) per view and vice versa.

ยณ Timber does not provide a front-end build process so you can implement whatever you prefer.

Email any factual inaccuracies to hi@atanas.dev so they can be corrected.

Features

  • All features from WP Emerge:
    • Named routes with custom URLs and query filters
    • Controllers
    • Middleware
    • PSR-7 Responses
    • View Composers
    • Service Container
    • Service Providers
    • PHP view layouts (a.k.a. automatic wrapping)
    • Support for PHP, Blade 5.4 and/or Twig 2 for views
  • Gutenberg support.
  • SASS + PostCSS for stylesheets. Separate bundles are created for front-end, administration, Gutenberg and login pages.
  • ES6 for JavaScript. Separate bundles are created for front-end, administration, Gutenberg and login pages.
  • Pure Webpack to transpile and bundle assets, create sprites, optimize images etc.
  • Hot Module Replacement for synchronized browser development.
  • Autoloading for all classes in your App\ namespace.
  • Automatic, fool-proof cache busting for all assets, including ones referenced in styles.
  • WPCS, JavaScript and SASS linting and fixing using a single yarn command.
  • Single-command optional CSS package installation:
    • Normalize.css
    • Boostrap 4
    • Bulma
    • Foundation
    • Tachyons
    • Tailwind CSS
    • Spectre.css
    • FontAwesome
  • WP Unit Test scaffolding for your own classes.

Requirements

Directory structure

wp-content/themes/your-theme
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ helpers/              # Helper files, add your own here as well.
โ”‚   โ”œโ”€โ”€ routes/               # Register your WP Emerge routes.
โ”‚   โ”‚   โ”œโ”€โ”€ admin.php
โ”‚   โ”‚   โ”œโ”€โ”€ ajax.php
โ”‚   โ”‚   โ””โ”€โ”€ web.php
โ”‚   โ”œโ”€โ”€ src/                  # PSR-4 autoloaded classes.
โ”‚   โ”‚   โ”œโ”€โ”€ Controllers/      # Controller classes for WP Emerge routes.
โ”‚   โ”‚   โ”œโ”€โ”€ Routing/          # Register your custom routing conditions etc.
โ”‚   โ”‚   โ”œโ”€โ”€ View/             # Register your view composers, globals etc.
โ”‚   โ”‚   โ”œโ”€โ”€ WordPress/        # Register post types, taxonomies, menus etc.
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”œโ”€โ”€ config.php            # WP Emerge configuration.
โ”‚   โ”œโ”€โ”€ helpers.php           # Require your helper files here.
โ”‚   โ””โ”€โ”€ hooks.php             # Register your actions and filters here.
โ”œโ”€โ”€ dist/                     # Bundles, optimized images etc.
โ”œโ”€โ”€ languages/                # Language files.
โ”œโ”€โ”€ resources/
โ”‚   โ”œโ”€โ”€ build/                # Build process configuration.
โ”‚   โ”œโ”€โ”€ fonts/
โ”‚   โ”œโ”€โ”€ images/
โ”‚   โ”œโ”€โ”€ scripts/
โ”‚   โ”‚   โ”œโ”€โ”€ admin/            # Administration scripts.
โ”‚   โ”‚   โ”œโ”€โ”€ editor/           # Gutenberg editor scripts.
โ”‚   โ”‚   โ”œโ”€โ”€ login/            # Login scripts.
โ”‚   โ”‚   โ””โ”€โ”€ theme/            # Front-end scripts.
โ”‚   โ”œโ”€โ”€ styles/
โ”‚   โ”‚   โ”œโ”€โ”€ admin/            # Administration styles.
โ”‚   โ”‚   โ”œโ”€โ”€ editor/           # Gutenberg editor styles.
โ”‚   โ”‚   โ”œโ”€โ”€ login/            # Login styles.
โ”‚   โ”‚   โ”œโ”€โ”€ shared/           # Shared styles.
โ”‚   โ”‚   โ””โ”€โ”€ theme/            # Front-end styles.
โ”‚   โ””โ”€โ”€ vendor/               # Any third-party, non-npm assets.
โ”œโ”€โ”€ vendor/                   # Composer packages.
โ”œโ”€โ”€ views/
โ”‚   โ”œโ”€โ”€ layouts/
โ”‚   โ””โ”€โ”€ partials/
โ”œโ”€โ”€ views-alternatives/       # Views for other engines like Blade.
โ”œโ”€โ”€ functions.php             # Bootstrap theme.
โ”œโ”€โ”€ screenshot.png            # Theme screenshot.
โ”œโ”€โ”€ style.css                 # Theme stylesheet.
โ””โ”€โ”€ ...

Notable directories

app/helpers/

Add PHP helper files here. Helper files should include function definitions only. See below for information on where to put actions, filters, classes etc.

app/src/

Add PHP class files here. All clases in the App\ namespace are autoloaded in accordance with PSR-4.

resources/images/

Add images for styling here. Optimized copies will be placed in dist/images/ when running the build process.

resources/styles/frontend/

Add .css and .scss files to add them to the front-end bundle. Don't forget to @import them in index.scss.

resources/styles/[admin,editor,login]/

These directories are for the admin, editor and login bundles, respectively. They work identically to the main resources/styles/frontend/ directory.

resources/scripts/frontend/

Add JavaScript files here to add them to the frontend bundle. The entry point is index.js.

resources/scripts/[admin,editor,login]/

These directories are for the admin, editor and login bundles, respectively. They work identically to the main resources/scripts/frontend/ directory.

views/

While views that follow the WordPress template hierarchy should go in the theme root directory (e.g. index.php, searchform.php, archive-post.php etc.), others should go in the following directories:

  1. views/layouts/ - Layouts that other views extend.
  2. views/partials/ - Small snippets that are meant to be reused throughout other views.
  3. views/ - Named custom post templates or views that don't fit anywhere else.

Avoid adding any PHP logic in any of these views, unless it pertains to layouting (PHP logic should go into helper files or WP Emerge controllers).

Contributing

WP Emerge Theme is completely open source and we encourage everybody to participate by: