├── .gitignore
├── src
├── session-manager.js
├── middlewares
│ ├── route
│ │ ├── updateHistory.js
│ │ ├── updateStore.js
│ │ └── fetchComments.js
│ └── setup
│ │ └── setupPopstate.js
├── editor.js
├── admin.js
├── components
│ ├── Comments.js
│ └── Post.js
├── helpers.js
└── theme.js
├── composer.json
├── style.css
├── footer.php
├── header.php
├── templates
├── comments
│ └── comments.php
├── index
│ ├── no-posts.php
│ ├── 404.php
│ ├── archive-pagination.php
│ ├── singular.php
│ ├── archive.php
│ ├── post.php
│ ├── archive-post.php
│ ├── comments.php
│ └── index.php
├── footer
│ └── footer.php
├── header
│ ├── header.php
│ └── noscript.php
└── compatibility-mode
│ └── index.php
├── index.php
├── package.json
├── webpack.config.js
├── README.md
├── functions.php
├── LICENSE
└── composer.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | vendor
2 | logs
3 | node_modules
4 | build
--------------------------------------------------------------------------------
/src/session-manager.js:
--------------------------------------------------------------------------------
1 | import { maybeFlushSessionCache } from "nicholas-router";
2 |
3 | maybeFlushSessionCache()
--------------------------------------------------------------------------------
/src/middlewares/route/updateHistory.js:
--------------------------------------------------------------------------------
1 | import { setHistory } from '../../helpers'
2 |
3 | export default ( args, next ) => {
4 | setHistory( args.url.href )
5 | next()
6 | }
--------------------------------------------------------------------------------
/src/editor.js:
--------------------------------------------------------------------------------
1 | import { registerPlugin } from '@wordpress/plugins';
2 | import CompatibilityModeToggle from 'nicholas-wp/editor/CompatibilityModeToggle'
3 |
4 | registerPlugin( 'theme', { render: () => } );
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "extra": {
3 | "installer-paths": {
4 | "vendor/{$vendor}/{$name}": [
5 | "type:wordpress-muplugin"
6 | ]
7 | }
8 | },
9 | "require": {
10 | "nicholas-wordpress/core": "^1.0"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/admin.js:
--------------------------------------------------------------------------------
1 | import { render } from '@wordpress/element'
2 | import fetch from 'nicholas-wp'
3 | import {Admin} from 'nicholas-wp/admin'
4 |
5 | // Render the app
6 | window.onload = () => render( , document.getElementById( 'app' ) )
7 |
8 | // Export fetch, so we can add midleware via PHP
9 | export { fetch }
--------------------------------------------------------------------------------
/style.css:
--------------------------------------------------------------------------------
1 | /*
2 | Theme Name: Nearly Headless Theme
3 | Author: A really cool developer
4 | Author URI: https://www.wordpress.org
5 | Description: A nearly headless WordPress theme, built on the Underpin framework
6 | Version: 1.0.0
7 | Requires at least: 5.8
8 | Tested up to: 5.8
9 | Requires PHP: 7.0
10 | Text Domain: theme
11 | */
--------------------------------------------------------------------------------
/footer.php:
--------------------------------------------------------------------------------
1 |
10 | = Nicholas\nicholas()->templates()->get_template( 'footer', 'footer' ) ?>
--------------------------------------------------------------------------------
/header.php:
--------------------------------------------------------------------------------
1 |
10 | = Nicholas\nicholas()->templates()->get_template( 'header', 'header' ) ?>
--------------------------------------------------------------------------------
/templates/comments/comments.php:
--------------------------------------------------------------------------------
1 | templates()->is_valid_template( $template ) || ! comments_open() ) {
13 | return;
14 | }
15 | comments_template();
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 |
10 | templates()->get_template( 'index', 'index' );
13 | get_footer();
--------------------------------------------------------------------------------
/templates/index/no-posts.php:
--------------------------------------------------------------------------------
1 | templates()->is_valid_template( $template ) ) {
12 | return;
13 | }
14 | ?>
15 |
16 | = nicholas()->__('Sorry, there is no content to show.') ?>
17 |
--------------------------------------------------------------------------------
/templates/index/404.php:
--------------------------------------------------------------------------------
1 | templates()->is_valid_template( $template ) ) {
12 | return;
13 | }
14 |
15 | ?>
16 |
17 | 404 - Page Not Found
18 | The page you are trying to visit could not be found.
--------------------------------------------------------------------------------
/templates/index/archive-pagination.php:
--------------------------------------------------------------------------------
1 | templates()->is_valid_template( $template ) ) {
12 | return;
13 | }
14 | $pagination = $template->get_param( 'pagination', '' );
15 | ?>
16 | = $pagination ?>
--------------------------------------------------------------------------------
/templates/index/singular.php:
--------------------------------------------------------------------------------
1 | templates()->is_valid_template( $template ) ) {
12 | return;
13 | }
14 | ?>
15 |
16 | = nicholas()->templates()->get_template( 'index', 'post' ) ?>
17 |
--------------------------------------------------------------------------------
/templates/footer/footer.php:
--------------------------------------------------------------------------------
1 | templates()->is_valid_template( $template ) ) {
12 | return;
13 | }
14 | ?>
15 |
16 |
17 |
18 |
21 |
22 |
23 |