Skip to content

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

License

Notifications You must be signed in to change notification settings

htmlburger/wpemerge-theme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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: