Code Monkey home page Code Monkey logo

wordplate's Introduction

WordPlate

wordplate

WordPlate is a modern WordPress stack which tries to simplify the fuzziness around WordPress development. Using the latest standards from PHP. WordPlate utilizes WordPress as its dependency through Composer.

composer create-project wordplate/wordplate

Build Status StyleCI Total Downloads Latest Version License

Contents

Why WordPlate?

Installation

To use WordPlate, you need to have PHP 5.6.4+ installed on your machine. You'll also optionally need Node.js and NPM installed if you want to use Elixir to compile your CSS and Javascript.

Make sure your server meets the following requirements:

  • PHP >= 5.6.4
  • Mbstring PHP Extension

Install WordPlate by issuing the Composer create-project command in your terminal:

composer create-project wordplate/wordplate

Configuration

The first thing you should do after installing WordPlate is to add WordPress salts to your .env environment file.

Typically, these strings should be 64 characters long. The strings can be set in the .env environment file. If you have not renamed the .env.example file to .env, you may do that now. If the WordPress salts is not set, your user sessions and other encrypted data will not be secure!

Please visit WordPlate's salt page and copy the WordPress salts to your environment file.

WordPress

WordPlate supports WordPress 4.0+ and comes with the latest version out of the box. If you want to specify an older version of WordPress you may add it to your composer.json file.

"require": {
  "johnpbloch/wordpress": "4.5.1"
}

This way you can lock the WordPress version number to the one you're working with. This could come in handy if you're opening your project six months from now and WordPress has released a new version with breaking changes.

Theming

Building your theme with WordPlate works like any other WordPress environment. Please use the WordPress documentation for reference.

Plate

Plate is a plugin with a bunch of defaults to help you make the most out of WordPress. It comes with handy features such as customizing the administrator dashboard. It is required by default. Please see the documentation for more information.

Plugins

WordPress Packagist comes straight out of the box with WordPlate. It mirrors the WordPress plugin and theme directories as a Composer repository.

How do I use it?

Require the desired plugin or theme using wpackagist-plugin or wpackagist-theme as the vendor name.

composer require wpackagist-plugin/wp-migrate-db

Packages are installed to public/plugins or public/themes.

Example

This is an example of how your composer.json file might look like.

"require": {
    "wordplate/framework": "^4.0",
    "wpackagist-plugin/polylang": "^1.0",
},

Please visit WordPress Packagist website for more information and examples.

Gulp

WordPlate has integrated Elixir. It provides a clean, fluent API for defining basic Gulp tasks for your WordPlate application.

Installation

Before triggering Elixir, you must first ensure that Node.js is installed on your machine.

node -v

If you don't have Node on your machine you can install it by visiting their download page.

Within a fresh installation of WordPlate, you'll find a package.json file in the root. Think of this like your composer.json file, except it defines Node dependencies instead of PHP. You may install the dependencies it references by running:

npm install

If you are developing on a Windows system or you are running your VM on a Windows host system, you may need to run the npm install command with the --no-bin-links switch enabled:

npm install --no-bin-links

Usage

To use Elixir and Gulp, please run one of the following commands:

Development

This script is for development. This script will first run all the Gulp tasks and then keep listening for changes you make in your asset files.

npm run dev

This script will automagically start a BrowserSync proxy. For more information about getting started with BrowserSync, please visit the Elixir documentation.

Production

Then there is a script you should run before publishing your application. This script will compile all your asset files and revision them for cache busting.

npm run prod

For more information about Elixir please visit the official document page.

Mail

To send email with WordPress you can use the wp_mail helper method. WordPlate provides a simple way to add custom SMTP credentials.

Require the mail package in the root directory of your project.

composer require wordplate/mail

Then update the credentials in your .env environment file with your SMTP keys and you're good to go. Please visit the WordPress codex to read more about the phpmailer_init action hook.

Multisite

To add multisite support to WordPlate you can head over to our multisite plugin here on GitHub.

Note: This plugin is still under development, you may use it at your own risk. We haven't had any issues ourselves but please be cautious.

Post Types

For custom post types we recommend looking at Extended CPTs by John Blackbourn. The package provides extended functionality to WordPress custom post types, allowing developers to quickly build post types without having to write the same code again and again.

register_extended_post_type('event');

Taxonomies

For taxonomies we recommend looking at Extended Taxonomies by John Blackbourn. The package provides extended functionality to WordPress custom taxonomies, allowing developers to quickly build custom taxonomies without having to write the same code again and again.

register_extended_taxonomy('location', 'event');

Custom Fields

For custom fields we recommend looking at the following plugins:

  • Advanced Custom Fields - Powerful fields for WordPress developers.
  • Papi - A different approach on how to work with fields and page types in WordPress.

Translations

WordPlate by default, doesn't provide translations. However, we're big fans of the Polylang plugin. We've created a bridge which makes it easy to integrate Polylang within your application.

Require the translator package, with Composer, in the root directory of your project.

composer require wordplate/translator

Login to the WordPress administrator dashboard and active the Polylang plugin.

Register the translations with the register_translations method.

register_translations([
    'general' => [
        'general-language-english' => 'The english language',
        'general-language-swedish' => 'The swedish language',
    ],
    'contact' => [
        'contact-email' => 'Contact page email string',
        'contact-mobile' => 'Contact page mobile string',
        'contact-telephone' => 'Contact page telephone string',
    ],
]);

Then to fetch and print a translation you can use the trans method.

echo trans('contact-email');

Please visit Polylang's documentation to find out more about translating your post types.

Helpers

WordPlate includes a variety of "helper" PHP functions. You are free to use them in your own applications if you find them convenient.

WordPlate support both Laravel's collections and helper methods. This means you can use great debugging methods such as dd() and string helpers like str_contains().

Available Methods

Below is a list of all supported helper methods.

Arrays Strings Miscellaneous
array_add camel_case collect
array_collapse class_basename dd
array_divide e dump
array_dot ends_with elixir
array_except snake_case env
array_first starts_with value
array_flatten str_contains
array_forget str_finish
array_get str_is
array_has str_limit
array_last str_plural
array_only str_random
array_pluck str_singular
array_prepend str_slug
array_pull studly_case
array_set title_case
array_sort
array_sort_recursive
array_where
head
last

Security

Though WordPlate makes your WordPress site more secure out of the box you should always try to get ahead. We suggest reading this article to learn more about WordPress security.

WordPlate comes with the wp-password-bcrypt package to replace WordPress's outdated and insecure MD5-based password hashing with the modern and secure bcrypt.

We recommend taking a look at the Soil plugin by Roots. It is a A WordPress plugin which contains a collection of modules to apply theme-agnostic front-end modifications. The plugin also address some security concerns for WordPress themes.

Contributing

Please review our contribution guidelines before submitting a pull request.

License

WordPlate is licensed under The MIT License (MIT).

wordplate's People

Contributors

vinkla avatar puredazzle avatar kexhest avatar aaemnnosttv avatar frozzare avatar helit avatar ligne13 avatar mikaelmattsson avatar wolfiezero avatar qwp6t avatar ttskch avatar

Watchers

Endrigo Antonini avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.