Skip to content

Commit

Permalink
Merge pull request #158 from wordplate/develop
Browse files Browse the repository at this point in the history
WordPlate 5.0
  • Loading branch information
vinkla authored Mar 27, 2017
2 parents 4473652 + a8e2eae commit e301f9b
Show file tree
Hide file tree
Showing 13 changed files with 182 additions and 206 deletions.
16 changes: 8 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ MAIL_USERNAME=null
MAIL_PASSWORD=null

# Generate your keys here: https://wordplate.github.io/salt/
AUTH_KEY='yourrandomstring'
SECURE_AUTH_KEY='yourrandomstring'
LOGGED_IN_KEY='yourrandomstring'
NONCE_KEY='yourrandomstring'
AUTH_SALT='yourrandomstring'
SECURE_AUTH_SALT='yourrandomstring'
LOGGED_IN_SALT='yourrandomstring'
NONCE_SALT='yourrandomstring'
AUTH_KEY=
SECURE_AUTH_KEY=
LOGGED_IN_KEY=
NONCE_KEY=
AUTH_SALT=
SECURE_AUTH_SALT=
LOGGED_IN_SALT=
NONCE_SALT=
48 changes: 34 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
WordPlate
=========
# WordPlate

![wordplate](https://cloud.githubusercontent.com/assets/499192/13548328/22cb8d6c-e2ee-11e5-8adf-33c8184181b1.jpg)
[![WordPlate](https://cloud.githubusercontent.com/assets/499192/24309675/09eec350-10cd-11e7-98f3-094003bc8e15.png)](https://wordplate.github.io)

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.

Expand Down Expand Up @@ -29,6 +28,7 @@ composer create-project wordplate/wordplate
- [Custom Fields](#custom-fields)
- [Helpers](#helpers)
- [Security](#security)
- [Upgrade Guide](#upgrade-guide)
- [Contributing](#contributing)

## Why WordPlate?
Expand Down Expand Up @@ -95,7 +95,7 @@ Building your theme with WordPlate works like any other WordPress environment. P
Require the desired plugin or theme using `wpackagist-plugin` or `wpackagist-theme` as the vendor name.

```bash
composer require wpackagist-plugin/wp-migrate-db
composer require wpackagist-plugin/polylang
```

Packages are installed to `public/plugins` or `public/themes`.
Expand All @@ -106,8 +106,8 @@ This is an example of how your `composer.json` file might look like.

```json
"require": {
"wordplate/framework": "^4.3",
"wpackagist-plugin/polylang": "^1.0",
"wordplate/framework": "^5.0",
"wpackagist-plugin/polylang": "^2.1",
},
```

Expand Down Expand Up @@ -167,15 +167,15 @@ Below is a list of all supported helper methods.

Arrays | Strings | Miscellaneous
------ | ------- | -------------
[array_add](https://laravel.com/docs/5.4/helpers#method-array-add) | [camel_case](https://laravel.com/docs/5.4/helpers#method-camel-case) | [collect](https://laravel.com/docs/5.4/helpers#method-collect)
[array_collapse](https://laravel.com/docs/5.4/helpers#method-array-collapse) | [class_basename](https://laravel.com/docs/5.4/helpers#method-class-basename) | [dd](https://laravel.com/docs/5.4/helpers#method-dd)
[array_divide](https://laravel.com/docs/5.4/helpers#method-array-divide) | [e](https://laravel.com/docs/5.4/helpers#method-e) | [dump](https://laravel.com/docs/5.4/helpers#method-dd)
[array_dot](https://laravel.com/docs/5.4/helpers#method-array-dot) | [ends_with](https://laravel.com/docs/5.4/helpers#method-ends-with) | [elixir](https://laravel.com/docs/5.3/helpers#method-elixir)
[array_add](https://laravel.com/docs/5.4/helpers#method-array-add) | [camel_case](https://laravel.com/docs/5.4/helpers#method-camel-case) | [asset](https://laravel.com/docs/5.4/helpers#method-asset)
[array_collapse](https://laravel.com/docs/5.4/helpers#method-array-collapse) | [class_basename](https://laravel.com/docs/5.4/helpers#method-class-basename) | [collect](https://laravel.com/docs/5.4/helpers#method-collect)
[array_divide](https://laravel.com/docs/5.4/helpers#method-array-divide) | [e](https://laravel.com/docs/5.4/helpers#method-e) | [dd](https://laravel.com/docs/5.4/helpers#method-dd)
[array_dot](https://laravel.com/docs/5.4/helpers#method-array-dot) | [ends_with](https://laravel.com/docs/5.4/helpers#method-ends-with) | [dump](https://laravel.com/docs/5.4/helpers#method-dd)
[array_except](https://laravel.com/docs/5.4/helpers#method-array-except) | [snake_case](https://laravel.com/docs/5.4/helpers#method-snake-case) | [env](https://laravel.com/docs/5.4/helpers#method-env)
[array_first](https://laravel.com/docs/5.4/helpers#method-array-first) | [starts_with](https://laravel.com/docs/5.4/helpers#method-starts-with) | [mix](https://laravel.com/docs/5.4/helpers#method-mix)
[array_flatten](https://laravel.com/docs/5.4/helpers#method-array-flatten) | [str_contains](https://laravel.com/docs/5.4/helpers#method-str-contains) | [value](https://laravel.com/docs/5.4/helpers#method-value)
[array_forget](https://laravel.com/docs/5.4/helpers#method-array-forget) | [str_finish](https://laravel.com/docs/5.4/helpers#method-str-finish) |
[array_get](https://laravel.com/docs/5.4/helpers#method-array-get) | [str_is](https://laravel.com/docs/5.4/helpers#method-str-is) |
[array_flatten](https://laravel.com/docs/5.4/helpers#method-array-flatten) | [str_contains](https://laravel.com/docs/5.4/helpers#method-str-contains) | [template_path](#template_path)
[array_forget](https://laravel.com/docs/5.4/helpers#method-array-forget) | [str_finish](https://laravel.com/docs/5.4/helpers#method-str-finish) | [value](https://laravel.com/docs/5.4/helpers#method-value)
[array_get](https://laravel.com/docs/5.4/helpers#method-array-get) | [str_is](https://laravel.com/docs/5.4/helpers#method-str-is) |
[array_has](https://laravel.com/docs/5.4/helpers#method-array-has) | [str_limit](https://laravel.com/docs/5.4/helpers#method-str-limit) |
[array_last](https://laravel.com/docs/5.4/helpers#method-array-last) | [str_plural](https://laravel.com/docs/5.4/helpers#method-str-plural) |
[array_only](https://laravel.com/docs/5.4/helpers#method-array-only) | [str_random](https://laravel.com/docs/5.4/helpers#method-str-random) |
Expand All @@ -189,13 +189,33 @@ Arrays | Strings | Miscellaneous
[head](https://laravel.com/docs/5.4/helpers#method-head) | |
[last](https://laravel.com/docs/5.4/helpers#method-last) | |

##### `template_path()`

The `template_path` function returns the fully qualified path to the current theme directory.

```php
$path = template_path();

$path = template_path('includes/article.php');
```

## 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](https://premium.wpmudev.org/blog/keeping-wordpress-secure-the-ultimate-guide) to learn more about [WordPress security](http://codex.wordpress.org/Hardening_WordPress).

WordPlate comes with the [`wp-password-bcrypt`](https://github.com/roots/wp-password-bcrypt) package to replace WordPress's outdated and insecure [MD5-based](https://en.wikipedia.org/wiki/MD5) password hashing with the modern and secure [bcrypt](https://en.wikipedia.org/wiki/Bcrypt).

We recommend taking a look at the [Soil plugin](https://roots.io/plugins/soil) by [Roots](https://roots.io). 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.
We recommend taking a look at the [Soil plugin](https://roots.io/plugins/soil) by [Roots](https://roots.io). It is 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.

## Upgrade Guide

If you want to upgrade from WordPlate 4 to 5 you can follow this guide.

1. Bump the version number in the `composer.json` file to `^5.0`.

2. Copy and paste the contents of the [`wp-config.php`](public/wp-config.php) file into your application.

3. Run `composer update` and everything should work as before.

## Contributing

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"require": {
"php": "^7.0",
"wordplate/framework": "^4.3",
"wordplate/plate": "^2.2"
"wordplate/framework": "^5.0",
"wordplate/plate": "^2.3"
},
"repositories": [
{
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"scripts": {
"dev": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --watch-poll --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
Expand Down
37 changes: 28 additions & 9 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
<?php

declare(strict_types=1);

/*
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
* This file is part of WordPlate.
*
* (c) Vincent Klaiber <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

/*
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
|--------------------------------------------------------------------------
| Theming WordPress
|--------------------------------------------------------------------------
|
| We need to define and tell WordPress to load the WordPress theme and
| output it to the client's browser.
|
*/

define('WP_USE_THEMES', true);

/* Loads the WordPress Environment and Template */
/*
|--------------------------------------------------------------------------
| Booting WordPress
|--------------------------------------------------------------------------
|
| This is the front to the WordPress application. This file doesn't do
| anything, but loads wp-blog-header.php which does and tells WordPress to
| load the theme.
|
*/

require __DIR__.'/wordpress/wp-blog-header.php';
2 changes: 1 addition & 1 deletion public/themes/index.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

// Silence is golden.
// Good work getting this far, future starter!
32 changes: 9 additions & 23 deletions public/themes/wordplate/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@

declare(strict_types=1);

/*
* Register plugin helpers.
*/
require __DIR__.'/library/plate.php';

/*
* Set theme defaults.
*/
// Register plugin helpers.
require template_path('library/plate.php');

// Set theme defaults.
add_action('after_setup_theme', function () {
// Show the admin bar.
show_admin_bar(false);
Expand Down Expand Up @@ -37,9 +33,7 @@
register_nav_menu('primary-menu', __('Primary Menu', 'wordplate'));
});

/*
* Enqueue and register scripts the right way.
*/
// Enqueue and register scripts the right way.
add_action('wp_enqueue_scripts', function () {
wp_deregister_script('jquery');

Expand All @@ -49,9 +43,7 @@
// wp_enqueue_script('wordplate');
});

/*
* Set custom title.
*/
// Set custom title.
add_filter('wp_title', function () {
global $post;

Expand All @@ -73,23 +65,17 @@
return sprintf('%s - %s', trim($post->post_title), $name);
});

/*
* Remove JPEG compression.
*/
// Remove JPEG compression.
add_filter('jpeg_quality', function () {
return 100;
}, 10, 2);

/*
* Set custom excerpt more.
*/
// Set custom excerpt more.
add_filter('excerpt_more', function () {
return '...';
});

/*
* Set custom excerpt length.
*/
// Set custom excerpt length.
add_filter('excerpt_length', function () {
return 101;
});
3 changes: 1 addition & 2 deletions public/themes/wordplate/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#6d9aea">

<?php wp_head(); ?>
Expand Down
25 changes: 13 additions & 12 deletions public/themes/wordplate/index.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<?php get_header(); ?>

<main role="main">
<?php if (have_posts()): while (have_posts()): the_post(); ?>
<article>
<header>
<h1><?php the_title(); ?></h1>
</header>
<?php the_content(); ?>
</article>
<?php endwhile; else: ?>
<article>
<p>Nothing to see.</p>
</article>
<?php endif; ?>
<?php if (have_posts()): while (have_posts()): the_post(); ?>
<article>
<header>
<h1><?php the_title(); ?></h1>
</header>

<?php the_content(); ?>
</article>
<?php endwhile; else: ?>
<article>
<p>Nothing to see.</p>
</article>
<?php endif; ?>
</main>

<?php get_footer();
52 changes: 18 additions & 34 deletions public/themes/wordplate/library/plate.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,26 @@
declare(strict_types=1);

/*
|--------------------------------------------------------------------------
| Plate
|--------------------------------------------------------------------------
|
| Plate provides a bunch of handy WordPress defaults to help you get the
| most out of WordPress development.
|
| Please see https://github.com/wordplate/plate
|
*/
|--------------------------------------------------------------------------
| Plate
|--------------------------------------------------------------------------
|
| Plate provides a bunch of handy WordPress defaults to help you get the
| most out of WordPress development.
|
| Please see https://github.com/wordplate/plate
|
*/

/*
* Remove menu items.
*/
// Remove menu items.
add_theme_support('plate-menu', [
'comments',
'dashboard',
'links',
'media',
]);

/*
* Remove meta boxes in post editor.
*/
// Remove meta boxes in post editor.
add_theme_support('plate-editor', [
'commentsdiv',
'commentstatusdiv',
Expand All @@ -43,9 +39,7 @@
//'tagsdiv-post_tag',
]);

/*
* Remove dashboard widgets.
*/
// Remove dashboard widgets.
add_theme_support('plate-dashboard', [
'dashboard_activity',
'dashboard_incoming_links',
Expand All @@ -58,9 +52,7 @@
//'dashboard_right_now',
]);

/*
* Remove links from admin toolbar.
*/
// Remove links from admin toolbar.
add_theme_support('plate-toolbar', [
'comments',
'wp-logo',
Expand All @@ -72,22 +64,14 @@
'search',
]);

/*
* Remove dashboard tabs.
*/
// Remove dashboard tabs.
add_theme_support('plate-tabs', ['help', 'screen-options']);

/*
* Set custom permalink structure.
*/
// Set custom permalink structure.
add_theme_support('plate-permalink', '/%postname%/');

/*
* Set custom login logo.
*/
// Set custom login logo.
add_theme_support('plate-login', sprintf('%s/%s', get_template_directory_uri(), '/assets/images/logo.png'));

/*
* Set custom footer text.
*/
// Set custom footer text.
add_theme_support('plate-footer', 'Thank you for creating with <a href="https://wordplate.github.io" target="_blank">WordPlate</a>.');
2 changes: 1 addition & 1 deletion public/themes/wordplate/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Theme Name: WordPlate
* Theme URI: https://wordplate.github.io
* Description: WordPress theme generated with <a href="https://wordplate.github.io">WordPlate</a>.
* Version: 1.0.0
* Version: 5.0.0
* Author: WordPlate
* Author URI: https://wordplate.github.io
*/
Loading

0 comments on commit e301f9b

Please sign in to comment.