Skip to content

Commit 5ca1d88

Browse files
authored
Merge pull request #27 from BeAPI/feature/seo-press-compat
SEOPress & Rank Math compat'
2 parents ecee49f + af49dcc commit 5ca1d88

19 files changed

Lines changed: 980 additions & 5672 deletions

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ Thumbs.db
2626
.wp-env.override.json
2727
phpcs.xml
2828
phpunit.xml
29+
30+
# Composer
31+
composer.lock
32+
33+
# Plugins
34+
.wp-env/plugins/

.wp-env.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"plugins": [
3-
"."
3+
".",
4+
".wp-env/plugins/seo-by-rank-math",
5+
".wp-env/plugins/wordpress-seo",
6+
".wp-env/plugins/wp-seopress"
47
]
58
}

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,30 @@ A Gutenberg block for SEO friendly FAQ in an accessible accordion.
2424
npm run build
2525
```
2626

27-
4. Start the WordPress environment and install Yoast SEO:
27+
4. Install PHP dependencies (downloads SEO plugins into `.wp-env/plugins/`):
2828

2929
```bash
30-
npm run setup:env
30+
composer install
3131
```
3232

33-
**Note:** On Windows, you may need to run the commands separately:
33+
5. Start the WordPress environment:
3434

3535
```bash
36-
npm run start:env
37-
# Wait for WordPress to be ready (about 10-15 seconds)
38-
npm run setup
36+
npm run env:start
3937
```
4038

39+
Yoast SEO, Rank Math, and SEOPress are mounted automatically via `.wp-env.json`.
40+
4141
### Available Scripts
4242

4343
- `npm run build` - Build the blocks for production
4444
- `npm run start` - Start the development server with hot reload
45-
- `npm run start:env` - Start the WordPress environment (wp-env)
46-
- `npm run stop:env` - Stop the WordPress environment
47-
- `npm run install:yoast` - Install and activate Yoast SEO plugin (required for schema generation)
48-
- `npm run setup:env` - Start wp-env and install Yoast SEO in one command
45+
- `npm run env:start` - Start the WordPress environment (wp-env)
46+
- `npm run env:stop` - Stop the WordPress environment
4947

5048
### Note
5149

52-
Yoast SEO is required for the FAQ schema (JSON-LD) generation. It is installed automatically via `npm run setup:env` but is not versioned in the repository.
50+
FAQ structured data (JSON-LD) requires Yoast SEO, Rank Math, or SEOPress. All three plugins are available in the local wp-env environment; keep only one active in the WordPress admin when testing a specific integration. SEO plugin files are not versioned in the repository (installed via Composer into `.wp-env/plugins/`).
5351

5452
## Changelog
5553

blockparty-faq.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,27 @@
4040
die( '-1' );
4141
}
4242

43+
if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
44+
include_once __DIR__ . '/vendor/autoload.php';
45+
}
46+
4347
// Plugin constants
4448
define( 'BLOCKPARTY_FAQ_VERSION', '2.0.3' );
4549

4650
// Plugin URL and PATH
4751
define( 'BLOCKPARTY_FAQ_DIR', plugin_dir_path( __FILE__ ) );
4852

53+
// Schema & SEO services
54+
require_once BLOCKPARTY_FAQ_DIR . 'includes/Schema/FAQ_Schema_Generator.php';
55+
require_once BLOCKPARTY_FAQ_DIR . 'includes/Schema/FAQ_Schema.php';
56+
require_once BLOCKPARTY_FAQ_DIR . 'includes/Services/Seo_Service_Interface.php';
57+
require_once BLOCKPARTY_FAQ_DIR . 'includes/Services/Yoast_Seo_Service.php';
58+
require_once BLOCKPARTY_FAQ_DIR . 'includes/Services/Rank_Math_Seo_Service.php';
59+
require_once BLOCKPARTY_FAQ_DIR . 'includes/Services/Seopress_Seo_Service.php';
60+
require_once BLOCKPARTY_FAQ_DIR . 'includes/Services/Seo_Service_Resolver.php';
61+
4962
// Hooks
50-
require_once BLOCKPARTY_FAQ_DIR . 'includes/hooks/schema.php';
51-
require_once BLOCKPARTY_FAQ_DIR . 'includes/schema/faq_schema.php';
63+
require_once BLOCKPARTY_FAQ_DIR . 'includes/Hooks/Schema_Hooks.php';
5264

5365
/**
5466
* Initialize plugin blocks.

composer.json

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,50 @@
2727
"php": "8.1"
2828
}
2929
},
30+
"extra": {
31+
"installer-paths": {
32+
".wp-env/plugins/{$name}/": [
33+
"type:wordpress-plugin"
34+
]
35+
}
36+
},
3037
"require": {
3138
"php": "^8.1 | ^8.2 | ^8.3 | ^8.4",
3239
"ext-json": "*",
3340
"composer/installers": "^1.0 || ^2.0"
3441
},
3542
"require-dev": {
3643
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
37-
"humanmade/psalm-plugin-wordpress": "^3.0",
3844
"overtrue/phplint": "^9.1",
3945
"php-parallel-lint/php-parallel-lint": "^1.3",
4046
"php-stubs/wordpress-seo-stubs": "^20.5",
4147
"phpcompatibility/phpcompatibility-wp": "^2.1",
4248
"phpro/grumphp-shim": "^1.5",
4349
"roave/security-advisories": "dev-latest",
4450
"roots/wordpress-no-content": "^6.0",
45-
"vimeo/psalm": "^5.20",
46-
"wp-coding-standards/wpcs": "^3.0"
51+
"wp-coding-standards/wpcs": "^3.3",
52+
"wp-plugin/seo-by-rank-math": "1.0.272",
53+
"wp-plugin/wordpress-seo": "27.9",
54+
"wp-plugin/wp-seopress": "10.0.1"
55+
},
56+
"repositories": [
57+
{
58+
"name": "wp-packages",
59+
"type": "composer",
60+
"url": "https://repo.wp-packages.org"
61+
}
62+
],
63+
"autoload": {
64+
"psr-4": {
65+
"Blockparty\\Faq\\": "includes/"
66+
}
4767
},
4868
"scripts": {
4969
"cs": "./vendor/bin/phpcs",
50-
"cb": "./vendor/bin/phpcbf",
51-
"psalm": "./vendor/bin/psalm"
70+
"cb": "./vendor/bin/phpcbf"
5271
},
5372
"scripts-descriptions": {
5473
"cs": "Run PHP CodeSniffer on codebase using custom ruleset.",
55-
"cb": "Run PHP Code Beautifier and Fixer on codebase using custom ruleset.",
56-
"psalm": "Run psalm on codebase using custom ruleset."
74+
"cb": "Run PHP Code Beautifier and Fixer on codebase using custom ruleset."
5775
}
5876
}

0 commit comments

Comments
 (0)