From 14315455ddc10ef1508b0a9798d8b86d6d7cf20b Mon Sep 17 00:00:00 2001
From: Cyd Stumpel
Date: Wed, 9 Oct 2024 11:57:59 +0200
Subject: [PATCH] really remove headless
---
.github/workflows/test.yml | 1 -
README.md | 4 +-
package-lock.json | 1 -
package.json | 9 ++--
template/config/dev.js | 2 +-
template/src/404.php | 6 +--
template/src/assets/scss/app.scss | 7 +--
.../src/assets/scss/typography/_usage.scss | 5 +-
template/src/footer.php | 2 -
template/src/functions.php | 5 +-
template/src/header.php | 48 +++++++++----------
template/src/includes/includes.php | 9 ----
template/src/includes/settings/index.php | 5 +-
template/src/includes/settings/url.php | 46 ------------------
template/src/index.php | 7 +--
template/src/page-home.php | 6 ---
template/src/page.php | 9 +---
template/src/single.php | 6 ---
18 files changed, 40 insertions(+), 138 deletions(-)
delete mode 100644 template/src/includes/settings/url.php
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index e5e1fa7..65034de 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -16,7 +16,6 @@ jobs:
- name: npm run try
run: |
npm ci
- npm run try:headless
npm run try:normal
env:
CI: true
diff --git a/README.md b/README.md
index f7069a7..84fd2e6 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
Make sure you have [npx](https://www.npmjs.com/package/npx) installed (`npx` is shipped by default since NPM `5.2.0`)
```bash
-npx automatise-wordpress
+npx automatise-wordpress@latest
```
## Credits
@@ -22,7 +22,7 @@ npx automatise-wordpress
This project is set up to work with Local by Flywheel
-## Updating
+## Updating this package:
```bash
npm version patch -m "Upgrade to %s; "
```
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 9ddd17c..c1d0061 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -16,7 +16,6 @@
"bin": {
"automatise-wordpress": "cli.js"
},
- "devDependencies": {},
"engines": {
"node": "^18"
}
diff --git a/package.json b/package.json
index 91a34e1..c5af447 100644
--- a/package.json
+++ b/package.json
@@ -16,11 +16,10 @@
"type": "git"
},
"scripts": {
- "try:headless": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"wordpressType\":\"headless\"}'",
- "try:normal": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"wordpressType\":\"normal\"}'",
- "try:smoothscroll": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"wordpressType\":\"normal\",\"smoothscroll\":true}'",
- "try:three": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"wordpressType\":\"normal\",\"smoothscroll\":true,\"three\":true}'",
- "try:local": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"extension\":\"local\",\"wordpressType\":\"normal\",\"smoothscroll\":true,\"three\":false}'",
+ "try:normal": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\"}'",
+ "try:smoothscroll": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"smoothscroll\":true}'",
+ "try:three": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"smoothscroll\":true,\"three\":true}'",
+ "try:local": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"smoothscroll\":true,\"three\":false}'",
"trypublish": "npm publish || true"
},
"dependencies": {
diff --git a/template/config/dev.js b/template/config/dev.js
index 3cd27c4..2c7802a 100644
--- a/template/config/dev.js
+++ b/template/config/dev.js
@@ -1,5 +1,5 @@
module.exports = {
- url: 'https://<%= packageName %>.<%= extension %>',
+ url: 'https://<%= packageName %>.local',
mode: 'development',
themeName: '<%= packageName %>',
publicPath: '/wp-content/themes/<%= packageName %>/assets/',
diff --git a/template/src/404.php b/template/src/404.php
index 70670ee..b520b3a 100644
--- a/template/src/404.php
+++ b/template/src/404.php
@@ -8,10 +8,6 @@
* @version 1.0
* @since 1.0
*/
-<% if (wordpressType === 'headless') { %>
-$uri = $_SERVER['REQUEST_URI'];
-wp_redirect('https://' . FRONTEND_DOMAIN . $uri, 301);
-exit();
-<% } %>
+
get_header();
get_footer();
diff --git a/template/src/assets/scss/app.scss b/template/src/assets/scss/app.scss
index 0d2f71b..b1d96c5 100644
--- a/template/src/assets/scss/app.scss
+++ b/template/src/assets/scss/app.scss
@@ -1,11 +1,8 @@
// Theme
@import 'typography/typography';
@import 'components/index';
-<% if(wordpressType === 'normal') { %>
@import '~matise-gryd/gryd-once.scss';
-<% } else { %>
-// @import '~matise-gryd/gryd-once.scss'; We don't include this one yet, only if we need to
-<% } %>
+
<% if (smoothscroll == 'true') { %>
@import 'scroll';
-<% } %>
+<% } %>
\ No newline at end of file
diff --git a/template/src/assets/scss/typography/_usage.scss b/template/src/assets/scss/typography/_usage.scss
index 00d6564..e5560bc 100644
--- a/template/src/assets/scss/typography/_usage.scss
+++ b/template/src/assets/scss/typography/_usage.scss
@@ -1,4 +1,4 @@
-<% if(wordpressType === 'normal') { %>
+
h1,
h2,
h3,
@@ -20,5 +20,4 @@ h1 {
line-height: 1;
@include min-('font-size', 2, 24);
@include max-('font-size', 2, 240);
-}
-<% } %>
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/template/src/footer.php b/template/src/footer.php
index 2b7a4ad..8662c32 100644
--- a/template/src/footer.php
+++ b/template/src/footer.php
@@ -15,11 +15,9 @@
<% } else { %>
<% } %>
- <% if (wordpressType === 'normal') { %>
- <% } %>
>
-<% if (wordpressType === 'normal') { %>
-
-
-<% } %>
+
+
<% if (smoothscroll == 'true') { %>
diff --git a/template/src/includes/includes.php b/template/src/includes/includes.php
index 267c9e2..c1cc798 100644
--- a/template/src/includes/includes.php
+++ b/template/src/includes/includes.php
@@ -14,16 +14,7 @@
//===================
require_once('settings/index.php');
-<% if (wordpressType === 'headless') { %>
-//===================
-// WP Core
-//===================
-require_once('wp-core/init.php');
-<% } %>
-
-<% if (wordpressType === 'normal') { %>
//===================
// Components and partials
//===================
require_once('svgs/generate.php');
-<% } %>
diff --git a/template/src/includes/settings/index.php b/template/src/includes/settings/index.php
index 5935424..7abb4af 100644
--- a/template/src/includes/settings/index.php
+++ b/template/src/includes/settings/index.php
@@ -3,7 +3,4 @@
require_once('acf.php');
require_once('image.php');
require_once('menu-settings.php');
-require_once('theme.php');
-<% if (wordpressType === 'headless') { %>
-require_once('url.php');
-<% } %>
\ No newline at end of file
+require_once('theme.php');
\ No newline at end of file
diff --git a/template/src/includes/settings/url.php b/template/src/includes/settings/url.php
deleted file mode 100644
index 3e20441..0000000
--- a/template/src/includes/settings/url.php
+++ /dev/null
@@ -1,46 +0,0 @@
- -1) {
- return $url;
- } else {
- $url = str_replace('https://' . API_DOMAIN, 'https://'. FRONTEND_DOMAIN , $url);
- if (MATISE_ENVIRONMENT === 'local') {
- $url = str_replace('https://', 'http://' , $url);
- }
- return $url;
- }
-}
-
-function change_rest_url($url, $path){
- if(!defined('API_DOMAIN') || !defined('FRONTEND_DOMAIN')){
- return $url;
- }
- $home = 'https://'.FRONTEND_DOMAIN.'/';
- $rest_home = 'https://'.API_DOMAIN.'/';
- if (strpos($url, $home.'wp-json/') > -1){
- return str_replace($home.'wp-json/', $rest_home.'wp-json/', $url);
- }
- return $url;
-}
-
-foreach( [ 'post', 'page', 'post_type' ] as $type ) {
- add_filter( $type . '_link', 'change_home_url' , 9999, 2);
-}
-add_filter('home_url', 'change_home_url' , 9999, 2);
-add_filter('rest_url', 'change_rest_url', 9999, 4);
-
-
-
-if (!headers_sent()) {
- header('Access-Control-Allow-Origin: *');
- header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
- header('Access-Control-Max-Age: 1000');
- header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');
-}
diff --git a/template/src/index.php b/template/src/index.php
index 279f493..64bb202 100644
--- a/template/src/index.php
+++ b/template/src/index.php
@@ -8,11 +8,7 @@
* @version 1.0
* @since 1.0
*/
-<% if (wordpressType === 'headless') { %>
-$uri = $_SERVER['REQUEST_URI'];
-wp_redirect('https://' . FRONTEND_DOMAIN . $uri, 301);
-exit();
-<% } else { %>
+
get_header();
the_post();
the_content();
@@ -36,4 +32,3 @@
diff --git a/template/src/page-home.php b/template/src/page-home.php
index d7dae6a..866dac7 100644
--- a/template/src/page-home.php
+++ b/template/src/page-home.php
@@ -3,16 +3,10 @@
* Template Name: Home Template
*/
-<% if (wordpressType === 'headless') { %>
-$uri = $_SERVER['REQUEST_URI'];
-wp_redirect('https://' . FRONTEND_DOMAIN . $uri, 301);
-exit();
-<% } else { %>
get_header();
the_post();
the_title();
the_content();
get_footer();
-<% } %>
?>
diff --git a/template/src/page.php b/template/src/page.php
index edc9ffb..9345ee3 100644
--- a/template/src/page.php
+++ b/template/src/page.php
@@ -8,14 +8,9 @@
* @version 1.0
* @since 1.0
*/
-<% if (wordpressType === 'headless') { %>
-$uri = $_SERVER['REQUEST_URI'];
-wp_redirect('https://' . FRONTEND_DOMAIN . $uri, 301);
-exit();
-<% } else { %>
+
get_header();
the_post();
the_title();
the_content();
-get_footer();
-<% } %>
+get_footer();
\ No newline at end of file
diff --git a/template/src/single.php b/template/src/single.php
index 741abe3..0ec8e72 100644
--- a/template/src/single.php
+++ b/template/src/single.php
@@ -8,14 +8,8 @@
* @version 1.0
* @since 1.0
*/
-<% if (wordpressType === 'headless') { %>
-$uri = $_SERVER['REQUEST_URI'];
-wp_redirect('https://' . FRONTEND_DOMAIN . $uri, 301);
-exit();
-<% } else { %>
get_header();
the_post();
the_title();
the_content();
get_footer();
-<% } %>