Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ Thumbs.db
.wp-env.override.json
phpcs.xml
phpunit.xml

# Composer
composer.lock

# Plugins
.wp-env/plugins/
5 changes: 4 additions & 1 deletion .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"plugins": [
"."
".",
".wp-env/plugins/seo-by-rank-math",
".wp-env/plugins/wordpress-seo",
".wp-env/plugins/wp-seopress"
]
}
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,30 @@ A Gutenberg block for SEO friendly FAQ in an accessible accordion.
npm run build
```

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

```bash
npm run setup:env
composer install
```

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

```bash
npm run start:env
# Wait for WordPress to be ready (about 10-15 seconds)
npm run setup
npm run env:start
```

Yoast SEO, Rank Math, and SEOPress are mounted automatically via `.wp-env.json`.

### Available Scripts

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

### Note

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.
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/`).

## Changelog

Expand Down
16 changes: 14 additions & 2 deletions blockparty-faq.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,27 @@
die( '-1' );
}

if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
include_once __DIR__ . '/vendor/autoload.php';
}

// Plugin constants
define( 'BLOCKPARTY_FAQ_VERSION', '2.0.3' );

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

// Schema & SEO services
require_once BLOCKPARTY_FAQ_DIR . 'includes/Schema/FAQ_Schema_Generator.php';
require_once BLOCKPARTY_FAQ_DIR . 'includes/Schema/FAQ_Schema.php';
require_once BLOCKPARTY_FAQ_DIR . 'includes/Services/Seo_Service_Interface.php';
require_once BLOCKPARTY_FAQ_DIR . 'includes/Services/Yoast_Seo_Service.php';
require_once BLOCKPARTY_FAQ_DIR . 'includes/Services/Rank_Math_Seo_Service.php';
require_once BLOCKPARTY_FAQ_DIR . 'includes/Services/Seopress_Seo_Service.php';
require_once BLOCKPARTY_FAQ_DIR . 'includes/Services/Seo_Service_Resolver.php';

// Hooks
require_once BLOCKPARTY_FAQ_DIR . 'includes/hooks/schema.php';
require_once BLOCKPARTY_FAQ_DIR . 'includes/schema/faq_schema.php';
require_once BLOCKPARTY_FAQ_DIR . 'includes/Hooks/Schema_Hooks.php';

/**
* Initialize plugin blocks.
Expand Down
32 changes: 25 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,50 @@
"php": "8.1"
}
},
"extra": {
"installer-paths": {
".wp-env/plugins/{$name}/": [
"type:wordpress-plugin"
]
}
},
"require": {
"php": "^8.1 | ^8.2 | ^8.3 | ^8.4",
"ext-json": "*",
"composer/installers": "^1.0 || ^2.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"humanmade/psalm-plugin-wordpress": "^3.0",
"overtrue/phplint": "^9.1",
"php-parallel-lint/php-parallel-lint": "^1.3",
"php-stubs/wordpress-seo-stubs": "^20.5",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"phpro/grumphp-shim": "^1.5",
"roave/security-advisories": "dev-latest",
"roots/wordpress-no-content": "^6.0",
"vimeo/psalm": "^5.20",
"wp-coding-standards/wpcs": "^3.0"
"wp-coding-standards/wpcs": "^3.3",
"wp-plugin/seo-by-rank-math": "1.0.272",
"wp-plugin/wordpress-seo": "27.9",
"wp-plugin/wp-seopress": "10.0.1"
},
"repositories": [
{
"name": "wp-packages",
"type": "composer",
"url": "https://repo.wp-packages.org"
}
],
"autoload": {
"psr-4": {
"Blockparty\\Faq\\": "includes/"
}
},
"scripts": {
"cs": "./vendor/bin/phpcs",
"cb": "./vendor/bin/phpcbf",
"psalm": "./vendor/bin/psalm"
"cb": "./vendor/bin/phpcbf"
},
"scripts-descriptions": {
"cs": "Run PHP CodeSniffer on codebase using custom ruleset.",
"cb": "Run PHP Code Beautifier and Fixer on codebase using custom ruleset.",
"psalm": "Run psalm on codebase using custom ruleset."
"cb": "Run PHP Code Beautifier and Fixer on codebase using custom ruleset."
}
}
Loading
Loading