htmlburger / wpemerge-theme
A modern WordPress starter theme which uses the WP Emerge framework
Installs: 3 751
Dependents: 0
Suggesters: 0
Security: 0
Stars: 286
Watchers: 19
Forks: 33
Open Issues: 1
Type:wordpress-theme
Requires
- php: >=5.5
- composer/installers: ^1.4
- htmlburger/wpemerge: ~0.17.0
- htmlburger/wpemerge-app-core: ~0.17.0
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^0.7.0
- filp/whoops: ~2.13.0
- htmlburger/wpemerge-cli: ~0.17.0
- symfony/debug: ~3.0
- wp-coding-standards/wpcs: ^2.0
README
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
- Development Team
- Comparison Table
- Features
- Non-goals
- Requirements
- Directory structure
- Contributing
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
¹ 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:
- 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:
views/layouts/
- Layouts that other views extend.views/partials/
- Small snippets that are meant to be reused throughout other views.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:
- Helper files (
app/helpers/*.php
) - Service classes
- WP Emerge Controllers
Contributing
WP Emerge Starter Theme is completely open source and we encourage everybody to participate by:
- Reviewing
.github/CONTRIBUTING.md
. - ⭐ the project on GitHub (https://github.com/htmlburger/wpemerge-theme)
- Posting bug reports (https://github.com/htmlburger/wpemerge-theme/issues)
- (Emailing security issues to hi@atanas.dev instead)
- Posting feature suggestions (https://github.com/htmlburger/wpemerge-theme/issues)
- Posting and/or answering questions (https://github.com/htmlburger/wpemerge-theme/issues)
- Submitting pull requests (https://github.com/htmlburger/wpemerge-theme/pulls)
- Sharing your excitement about WP Emerge with your community