feat: Initial WordPress project

This commit is contained in:
2026-03-18 08:06:28 -04:00
commit 22cdda7fbf
40 changed files with 8903 additions and 0 deletions

View File

24
wp-content/themes/headless/.gitignore vendored Normal file
View File

@@ -0,0 +1,24 @@
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist
# Node dependencies
node_modules
# Logs
logs
*.log
# Misc
.DS_Store
.fleet
.idea
# Local env files
.env
.env.*
!.env.example

View File

@@ -0,0 +1 @@
shamefully-hoist=true

View File

@@ -0,0 +1,19 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"experimentalSortImports": {
"groups": [
["side_effect"],
["builtin"],
["external", "type-external"],
["internal", "type-internal"],
["parent", "type-parent"],
["sibling", "type-sibling"],
["index", "type-index"]
]
},
"experimentalTailwindcss": {
"attributes": ["class"],
"functions": ["tv"],
"stylesheet": "./app/assets/css/_main.css"
}
}

View File

@@ -0,0 +1,22 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"categories": {},
"env": {
"builtin": true,
"browser": true,
"node": true
},
"globals": {},
"ignorePatterns": [],
"plugins": ["import", "vue"],
"rules": {
"vue/define-emits-declaration": ["error", "type-based"],
"vue/define-props-declaration": ["error", "type-based"],
"vue/require-typed-ref": "error"
},
"settings": {
"vitest": {
"typecheck": false
}
}
}

View File

@@ -0,0 +1,3 @@
{
"recommendations": ["oxc.oxc-vscode"]
}

View File

@@ -0,0 +1,25 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Nuxt server",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/nuxt/bin/nuxt.mjs",
"runtimeArgs": ["--inspect"],
"args": ["dev"],
"autoAttachChildProcesses": true,
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"]
},
{
"name": "Nuxt client",
"type": "chrome",
"request": "launch",
"sourceMaps": true,
"trace": false,
"url": "http://localhost:3000",
"userDataDir": "${env:HOME}/.vscode/chromium-profile"
}
]
}

View File

@@ -0,0 +1,35 @@
{
"[css]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[json]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[postcss]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[scss]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[vue]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"editor.codeActionsOnSave": {
"source.fixAll": "always"
},
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.formatOnSave": true,
"editor.quickSuggestions": {
"strings": "on"
},
"eslint.enable": false
}

View File

@@ -0,0 +1 @@
# Changelog

View File

@@ -0,0 +1,75 @@
# Nuxt Minimal Starter
Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
## Setup
Make sure to install dependencies:
```bash
# npm
npm install
# pnpm
pnpm install
# yarn
yarn install
# bun
bun install
```
## Development Server
Start the development server on `http://localhost:3000`:
```bash
# npm
npm run dev
# pnpm
pnpm dev
# yarn
yarn dev
# bun
bun run dev
```
## Production
Build the application for production:
```bash
# npm
npm run build
# pnpm
pnpm build
# yarn
yarn build
# bun
bun run build
```
Locally preview production build:
```bash
# npm
npm run preview
# pnpm
pnpm preview
# yarn
yarn preview
# bun
bun run preview
```
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.

View File

@@ -0,0 +1,8 @@
<template>
<div>
<NuxtRouteAnnouncer />
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
</div>
</template>

View File

@@ -0,0 +1,5 @@
<template>
<div id="layout-default">
<slot />
</div>
</template>

View File

@@ -0,0 +1,3 @@
<template>
<div id="page-node-from-uri">TODO: [...uri].vue</div>
</template>

View File

@@ -0,0 +1,14 @@
<?php
// Core
require_once __DIR__ . '/includes/core/theme-setup.php';
// Vendors
require_once __DIR__ . '/includes/vendors/acf.php';
require_once __DIR__ . '/includes/vendors/rankmath.php';
require_once __DIR__ . '/includes/vendors/tinymce.php';
require_once __DIR__ . '/includes/vendors/wpgraphql.php';
// WPGraphQL
require_once __DIR__ . '/includes/wpgraphql/media-focus-point.php';
require_once __DIR__ . '/includes/wpgraphql/term-connection.php';

View File

@@ -0,0 +1,27 @@
<?php
// Setup theme
add_action( 'after_setup_theme', 'headless_after_setup_theme' );
function headless_after_setup_theme() {
// Load textdomain
load_theme_textdomain( 'headless', get_theme_file_path( 'languages' ) );
// Theme features
add_theme_support( 'custom-logo' );
add_theme_support( 'editor-styles' );
remove_theme_support( 'core-block-patterns' );
// Register menus
register_nav_menu( 'main', __( "Main menu", 'headless' ) );
// Register sidebars
}
// Display theme version in admin footer
add_filter( 'update_footer', 'headless_update_footer', 100 );
function headless_update_footer() {
$package_json = json_decode( file_get_contents( get_theme_file_path( 'package.json' ) ), true );
$name = $package_json['name'] ?? 'headless';
$version = $package_json['version'] ?? '(unknown)';
return sprintf( '%s v%s', esc_html( $name ), esc_html( $version ) );
}

View File

@@ -0,0 +1,15 @@
<?php
// Disable ACF / ACFE modules
add_filter( 'acf/settings/enable_post_types', '__return_false' );
add_action( 'acf/init', 'headless_acf_init' );
function headless_acf_init() {
acf_update_setting( 'acfe/modules/block_types', false );
acf_update_setting( 'acfe/modules/categories', false );
acf_update_setting( 'acfe/modules/forms', false );
acf_update_setting( 'acfe/modules/options', false );
acf_update_setting( 'acfe/modules/options_pages', false );
acf_update_setting( 'acfe/modules/post_types', false );
acf_update_setting( 'acfe/modules/taxonomies', false );
acf_update_setting( 'acfe/modules/templates', false );
}

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1,139 @@
<?php
// Enable formats (styleselect) in TinyMCE
add_filter( 'mce_buttons', 'headless_tinymce_styleselect' );
function headless_tinymce_styleselect( $buttons ) {
array_unshift( $buttons, 'styleselect' );
return $buttons;
}
// Configure TinyMCE
add_filter( 'tiny_mce_before_init', 'headless_tiny_mce_before_init' );
function headless_tiny_mce_before_init( $settings ) {
// Reset TinyMCE editor CSS
if ( isset( $settings['content_css'] ) ) {
$content_css = explode( ',', $settings['content_css'] );
unset( $content_css[1] ); // wp-content.min.css
$settings['content_css'] = implode( ',', $content_css );
}
// Format styles
$settings['style_formats'] = wp_json_encode(
array(
array(
'title' => "Caractères",
'items' => array(// Inline styles
array(
'title' => __( "Semi-bold", 'headless' ),
'inline' => 'span',
'classes' => 'font-semibold',
),
),
),
array(
'title' => "Liens",
'items' => array(// Link styles
array(
'title' => "Lien (opacité)",
'selector' => 'a',
'classes' => 'link-opacity',
),
),
),
array(
'title' => "Listes",
'items' => array(// List styles
array(
'title' => "Liste horizontale",
'selector' => 'ul,ol',
'classes' => 'list-horizontal',
),
),
),
array(
'title' => "Paragraphes",
'items' => array(// Paragraph styles
array(
'title' => "Paragraphe vedette",
'block' => 'p',
'classes' => 'paragraph-lead',
),
),
),
array(
'title' => "Titres",
'items' => array(// Heading styles
array(
'title' => "Titre 1",
'selector' => 'h1,h2,h3,h4',
'classes' => 'heading-1',
),
array(
'title' => "Titre 2",
'selector' => 'h1,h2,h3,h4',
'classes' => 'heading-2',
),
array(
'title' => "Titre 3",
'selector' => 'h1,h2,h3,h4',
'classes' => 'heading-3',
),
array(
'title' => "Titre 4",
'selector' => 'h1,h2,h3,h4',
'classes' => 'heading-4',
),
),
),
)
);
// Block styles
$settings['block_formats'] = implode(
';',
array(
'Paragraph=p',
'Heading 1=h1',
'Heading 2=h2',
'Heading 3=h3',
'Heading 4=h4',
)
);
return $settings;
}
// Override TinyMCE editor styles
add_filter( 'mce_css', 'headless_override_editor_styles' );
function headless_override_editor_styles() {
return get_stylesheet_directory_uri() . '/editor-style.css';
}
// Remove default TinyMCE styles for all editors (WordPress & ACF)
add_action( 'admin_print_footer_scripts', 'headless_remove_tinymce_default_styles', 99 );
function headless_remove_tinymce_default_styles() {
?>
<script>
(function($) {
if (typeof tinymce !== 'undefined') {
tinymce.on('AddEditor', function({editor}) {
editor.on('init', function() {
$(editor.iframeElement).contents().find("link[href*='content.min.css']").remove();
});
});
}
})(jQuery);
</script>
<?php
}
// Convert absolute URLs to relative in link query
add_filter( 'wp_link_query', 'headless_tinymce_relative_urls' );
function headless_tinymce_relative_urls( $results ) {
foreach ( $results as &$result ) {
if ( empty( $result['permalink'] ) ) {
continue;
}
$result['permalink'] = str_replace( get_home_url(), '', $result['permalink'] );
}
return $results;
}

View File

@@ -0,0 +1,17 @@
<?php
// Default WPGraphQL settings
add_filter( 'graphql_get_setting_section_field_value', 'headless_wpgraphql_settings', 10, 5 );
function headless_wpgraphql_settings( $value, $default_value, $option_name, $section_fields, $section_name ) {
if ( $section_name === 'graphql_general_settings' ) {
switch ( $option_name ) {
case 'graphql_endpoint':
$value = 'graphql';
break;
case "public_introspection_enabled":
$value = "on";
break;
}
}
return $value;
}

View File

@@ -0,0 +1,17 @@
<?php
// Expose 'bg_pos_desktop' post meta on MediaItem type in WPGraphQL
add_action( 'graphql_register_types', 'leblanc_graphql_register_media_focus_point' );
function leblanc_graphql_register_media_focus_point() {
register_graphql_field(
'MediaItem',
'objectPosition',
array(
'type' => 'String',
'description' => 'CSS object-position value from Media Focus Point plugin',
'resolve' => static function ( $media_item ) {
return get_post_meta( $media_item->databaseId, 'bg_pos_desktop', true );
},
)
);
}

View File

@@ -0,0 +1,13 @@
<?php
// Override term connection query args
add_filter( 'graphql_term_object_connection_query_args', 'headless_graphql_term_object_connection_query_args', 10, 3 );
function headless_graphql_term_object_connection_query_args( $query_args, $source, $args ) {
// Sort by 'order' meta value instead of legacy 'term_order' field
if ( 'term_order' === $args['where']['orderby'] ?? false ) {
$query_args['meta_key'] = 'order';
$query_args['orderby'] = 'meta_value_num';
}
return $query_args;
}

View File

@@ -0,0 +1,5 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: "2026-03-18",
devtools: { enabled: true },
});

View File

@@ -0,0 +1,49 @@
{
"name": "@lewebsimple/headless",
"version": "0.1.0",
"private": true,
"description": "Headless WordPress theme based on Nuxt.",
"type": "module",
"scripts": {
"build": "pnpm --sequential /build:.*/",
"build:nuxt": "nuxt build",
"dev": "nuxt dev",
"format": "oxfmt .",
"lint": "oxlint . --fix",
"preview": "nuxt preview",
"postinstall": "pnpm --sequential /postinstall:.*/",
"postinstall:nuxt": "nuxt prepare",
"release": "oxlint . && oxfmt --check . && nuxt typecheck && changelogen --noAuthors --release --push"
},
"dependencies": {
"nuxt": "^4.4.2",
"vue": "^3.5.30",
"vue-router": "^5.0.3"
},
"devDependencies": {
"changelogen": "^0.6.2",
"oxfmt": "^0.41.0",
"oxlint": "^1.56.0",
"typescript": "^5.9.3",
"vue-tsc": "^3.2.6"
},
"pnpm": {
"overrides": {
"@tiptap/core": "3.14.0",
"@tiptap/pm": "3.14.0"
},
"onlyBuiltDependencies": [
"@parcel/watcher",
"esbuild",
"sharp",
"unrs-resolver",
"vue-demi",
"workerd"
]
},
"changelog": {
"types": {
"chore": false
}
}
}

7219
wp-content/themes/headless/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,2 @@
User-Agent: *
Disallow:

View File

@@ -0,0 +1,8 @@
/*
Theme Name: Headless
Author: Pascal Martineau <pascal@lewebsimple.ca>
Author URI: https://websimple.com/
Description: Headless WordPress theme based on Nuxt.
Text Domain: headless
Template: kaliroots
*/

View File

@@ -0,0 +1,18 @@
{
// https://nuxt.com/docs/guide/concepts/typescript
"files": [],
"references": [
{
"path": "./.nuxt/tsconfig.app.json"
},
{
"path": "./.nuxt/tsconfig.server.json"
},
{
"path": "./.nuxt/tsconfig.shared.json"
},
{
"path": "./.nuxt/tsconfig.node.json"
}
]
}