PhpDev.App
htmlburger/wpemerge-theme

htmlburger/wpemerge-theme

Stars: 281

Forks: 31

Pull Requests: 21

Issues: 51

Watchers: 17

Last Updated: 2022-04-16 18:32:33

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

License: GNU General Public License v2.0

Languages: PHP, JavaScript, CSS, SCSS, Blade

https://wpemerge.com/

WP Emerge Starter Theme Logo

Packagist Build Gitter

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

This is the WP Emerge Starter 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 [email protected] 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 and custom bundles can be added easily.
  • ES6 for JavaScript. Separate bundles are created for front-end, administration, Gutenberg and login pages and custom bundles can be added easily.
  • 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 MyApp\ 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.

Non-goals

  • Taking over the WordPress main query.

    WP Emerge does not take over the main query - it actively works with it.

  • Taking over WordPress routing.

    WP Emerge does not take over WordPress' routing - it actively works with it. The only exception to this are hardcoded URLs explicitly added by a user.

  • Reinventing WordPress APIs using object-oriented interfaces.

    WP Emerge does not provide alternative APIs for registering post types, taxonomies or the like for little added benefit. Instead, it provides logical and handy places for developers to use core APIs.

  • Using a third party engine by default.

    WP Emerge uses PHP by default in the same way WordPress does but with added features. Using a third party engine is entirely optional and requires installing an extension.

  • Include most of Laravel or another framework.

    WP Emerge is lean and tuned for WordPress. While inspired by Laravel, it does not come with any illuminate/* packages. There are only 2 third party production dependencies:

    • pimple/pimple - The single-file PHP service container.
    • guzzlehttp/psr7 - A PSR-7 Request and ServerRequest implementation.

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.
โ”‚   โ””โ”€โ”€ version.php           # WP Emerge version handling.
โ”œโ”€โ”€ 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.
โ”‚   โ”‚   โ””โ”€โ”€ frontend/         # Front-end scripts.
โ”‚   โ”œโ”€โ”€ styles/
โ”‚   โ”‚   โ”œโ”€โ”€ admin/            # Administration styles.
โ”‚   โ”‚   โ”œโ”€โ”€ editor/           # Gutenberg editor styles.
โ”‚   โ”‚   โ”œโ”€โ”€ login/            # Login styles.
โ”‚   โ”‚   โ”œโ”€โ”€ frontend/         # Front-end styles.
โ”‚   โ”‚   โ””โ”€โ”€ shared/           # Shared 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.
โ”œโ”€โ”€ wpemerge                  # WP Emerge CLI shortcut.
โ””โ”€โ”€ ...

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 MyApp\ 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. Business logic should go into:

Contributing

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