├── .babelrc ├── LICENSE ├── README.md ├── _config.yml ├── footer.php ├── functions.php ├── header.php ├── inc ├── page-footer.php ├── page-header.php └── wp_head.php ├── index.php ├── package.json ├── page-CustomPage1.php ├── page-history.jsx ├── page-history.php ├── page.php ├── screenshot.png ├── single.php ├── src ├── css │ └── main.css ├── index.jsx └── js │ ├── API.jsx │ ├── Actions │ └── ServerActions.jsx │ ├── AjaxDispatcher.jsx │ ├── AppDispatcher.jsx │ ├── Components │ ├── Footer.jsx │ ├── Menu.jsx │ └── Page.jsx │ ├── Constants.jsx │ └── Stores │ └── DataStore.jsx ├── style.css ├── webpack.dev.config.js └── webpack.prod.config.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "react", 4 | "stage-0", 5 | "es2015" 6 | ], 7 | plugins: [ 8 | [ 9 | 'wildcard', { 10 | 'exts': ["jsx"] 11 | }, 12 | 'include', { 13 | 'nostrip': true 14 | } 15 | ] 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016-present ZENITHTECH, LLC 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # wordpress-react 2 | Componentized single-page [Wordpress](https://wordpress.com/) bootstrapped theme built with [React](https://facebook.github.io/react/) and [Flux](https://facebook.github.io/flux/), routing with [react-router](https://github.com/ReactTraining/react-router/tree/master/packages/react-router), and bundling with [Webpack](https://github.com/webpack/webpack). 3 | 4 | ## Features 5 | - No requirement to install any Wordpress plugins, works out-of-the-box 6 | - No requirement for special `.htaccess` settings 7 | - Ability to create regular Wordpress custom templates, and include shortcodes, JS, and PHP 8 | - Ability to create custom JSX React component templates (See [Custom JSX templates examples](#custom-react-components-in-jsx-templates-examples)) 9 | - Ability to use multiple menus (eg. header menu, footer menu) 10 | - Menus built on the client-side from flat trees 11 | - Separate `dev` and `production` builds (accessed with the `?dev` URL query param) (See [Examples](#examples) below) 12 | - Maintains non-WP URL query params thoughout the app (See [Query param examples](#query-param-examples) below) 13 | - Requested pages are cached for the session and not requested again 14 | - Ability to differ cached pages from non-cached 15 | - Ability to access pages not in the menu and maintain routing 16 | - Ability to access pages via any standard permalink type (See [Notes](#notes) below) 17 | - Dynamic `
` tag, `wp_head()` and `wp_footer()` hooks 18 | - Ability install and use WP plugins regularly (See [Plugin test examples](#plugin-test-examples) below) 19 | - PageSpeed results near 100% out-of-the-box (while plugins deactivated): https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fzenitht.com%2Fwp%2Fblog%2F&tab=desktop 20 | 21 | ---- 22 | 23 | This is an experimental theme. Not recommended for use on a live site. 24 | 25 | ---- 26 | 27 | ## Installation 28 | 29 | 1. Download or clone this repository into your Wordpress 'themes' folder 30 | 2. Activate the theme in wp-admin 31 | 3. `cd` into this theme folder 32 | 4. Run `npm install` 33 | 5. Build with webpack: 34 | 35 | a. `npm run dev` to build the dev version 36 | 37 | b. `npm run prod` to build the production version 38 | 39 | 6. Set your WP Permalinks settings to Post name 40 | 41 | That's all! 42 | 43 | ---- 44 | 45 | ## Notes 46 | 47 | For internal routing purposes it's recommended above to set Permalinks to Post name. A user would still be able to access any page if they arrive to a page under other permalink types. 48 | 49 | ---- 50 | 51 | ## Examples 52 | 53 | Example of production build (default): 54 | 55 | [https://zenitht.com/wp/](https://zenitht.com/wp/) 56 | 57 | Example of dev build accessed with `dev` param: 58 | 59 | [https://zenitht.com/wp/?dev](https://zenitht.com/wp/?dev) 60 | 61 | Example of page not in the menu: 62 | 63 | [https://zenitht.com/wp/page-not-in-menu/](https://zenitht.com/wp/page-not-in-menu/) 64 | 65 | Example of accessing page via Plain permalink type: 66 | 67 | [https://zenitht.com/wp/?p=35](https://zenitht.com/wp/?p=35) 68 | 69 | Example of page with JS alert in content in Text editing mode: 70 | 71 | [https://zenitht.com/wp/level-1/](https://zenitht.com/wp/level-1/) 72 | 73 | Example of [custom template](page-CustomPage1.php) page, with multiple JS tags, and PHP: 74 | 75 | [https://zenitht.com/wp/page-using-custom-template/](https://zenitht.com/wp/page-using-custom-template/) 76 | 77 | Example of page with status set as 'Draft' 78 | 79 | [https://zenitht.com/wp/?page_id=1859](https://zenitht.com/wp/?page_id=1859) 80 | 81 | 82 | 83 | ## Custom React components in JSX templates examples 84 | 85 |  86 | 87 | Example of custom JSX React component template, consisting of [page-history.jsx](page-history.jsx) and [page-history.php](page-history.php) pair: 88 | 89 | [https://zenitht.com/wp/history/](https://zenitht.com/wp/history/) 90 | 91 | See more details at [https://zenitht.com/wp/jsx-custom-templates/](https://zenitht.com/wp/jsx-custom-templates/). 92 | 93 | 94 | 95 | ## Query param examples 96 | 97 | Example of production build accessed with `page_id&someParam` params, maintaining `someParam` param: 98 | 99 | [https://zenitht.com/wp/?page_id=35&someParam=123123](https://zenitht.com/wp/?page_id=35&someParam=123123) 100 | 101 | Example of dev build accessed with `dev&p` params, maintaining `dev` param: 102 | 103 | [https://zenitht.com/wp/?p=35&dev](https://zenitht.com/wp/?p=35&dev) 104 | 105 | Example of dev build accessed with `dev&page_id` params, maintaining `dev` param: 106 | 107 | [https://zenitht.com/wp/?page_id=35&dev](https://zenitht.com/wp/?page_id=35&dev) 108 | 109 | Example of dev build accessed with `page_id&dev&p&someParam` params, maintaining `dev&someParam` params: 110 | 111 | [https://zenitht.com/wp/?page_id=35&dev&someParam=123123](https://zenitht.com/wp/?page_id=35&dev&someParam=123123) 112 | 113 | 114 | 115 | ## Plugin test examples 116 | 117 | Example of [wordpress-zSlider](https://github.com/zenithtech/wordpress-zSlider) within custom template: 118 | 119 | [https://zenitht.com/wp/wordpress-zslider-test/](https://zenitht.com/wp/wordpress-zslider-test/) 120 | 121 | Plugin test using BWS Captcha WP plugin: 122 | 123 | [https://zenitht.com/wp/bws-captcha-shortcode-plugin-test/](https://zenitht.com/wp/bws-captcha-shortcode-plugin-test/) 124 | 125 | Plugin test using ConvertPlug WP plugin: 126 | 127 | [https://zenitht.com/wp/wp-plugin-test-convertplug/](https://zenitht.com/wp/wp-plugin-test-convertplug/) 128 | 129 | Plugin test using Ninja Forms WP plugin: 130 | 131 | [https://zenitht.com/wp/plugin-test-ninja-forms/](https://zenitht.com/wp/plugin-test-ninja-forms/) 132 | 133 | 134 | ---- 135 | 136 | ## License ## 137 | 138 | This package is licensed under MIT license. See [LICENSE](LICENSE) for details. 139 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-architect -------------------------------------------------------------------------------- /footer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |