Fix code quality issues and Markdown formatting

This commit is contained in:
2025-04-21 21:15:29 +01:00
parent e8d81ef45b
commit ed160ed51b
5 changed files with 64 additions and 62 deletions

View File

@@ -10,7 +10,7 @@ WordPress Multisite allows you to run multiple WordPress sites from a single Wor
The plugin includes a dedicated directory for multisite-specific functionality:
```
```text
includes/
└── Multisite/
├── class-multisite.php # Base class for multisite functionality
@@ -23,8 +23,8 @@ includes/
The `Multisite` class in `includes/Multisite/class-multisite.php` provides a foundation for multisite-specific functionality. It includes:
- A constructor for initialization
- Example methods for multisite functionality
* A constructor for initialization
* Example methods for multisite functionality
### 2. Load Multisite Classes
@@ -34,7 +34,7 @@ To use multisite-specific functionality, you need to load and initialize the cla
// Load multisite support classes if in multisite environment
if ( is_multisite() ) {
require_once WP_PLUGIN_STARTER_TEMPLATE_PATH . 'includes/Multisite/class-multisite.php';
// Initialize multisite support
$multisite = new WPALLSTARS\PluginStarterTemplate\Multisite\Multisite();
}
@@ -49,14 +49,14 @@ You can extend the base `Multisite` class or create additional classes in the `M
namespace WPALLSTARS\PluginStarterTemplate\Multisite;
class Domain_Mapping extends Multisite {
public function __construct() {
parent::__construct();
// Add hooks for domain mapping functionality
add_action( 'init', array( $this, 'register_domain_mapping' ) );
}
public function register_domain_mapping() {
// Implement domain mapping functionality
}
@@ -96,13 +96,13 @@ add_action( 'wp_initialize_site', array( $this, 'on_site_creation' ), 10, 2 );
public function on_site_creation( $new_site, $args ) {
// Get the blog ID
$blog_id = $new_site->blog_id;
// Switch to the new blog
switch_to_blog( $blog_id );
// Perform site-specific setup
update_option( 'your_plugin_option', 'default_value' );
// Restore the current blog
restore_current_blog();
}
@@ -119,10 +119,10 @@ add_action( 'network_admin_edit_your_plugin_action', array( $this, 'save_network
public function save_network_settings() {
// Check nonce
check_admin_referer( 'your_plugin_nonce' );
// Save settings
update_site_option( 'your_plugin_network_option', sanitize_text_field( $_POST['your_option'] ) );
// Redirect back to settings page
wp_redirect( add_query_arg( array(
'page' => 'your-plugin-slug',

View File

@@ -19,6 +19,7 @@ We use `@wordpress/env` and Cypress for testing our plugin.
### Installation
1. Clone the repository:
```bash
git clone https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding.git
cd wp-plugin-starter-template-for-ai-coding
@@ -37,8 +38,8 @@ We use `@wordpress/env` and Cypress for testing our plugin.
```
This will:
- Start a WordPress environment using wp-env
- Activate our plugin
* Start a WordPress environment using wp-env
* Activate our plugin
2. Run Cypress tests for single site:
```bash
@@ -51,8 +52,8 @@ We use `@wordpress/env` and Cypress for testing our plugin.
```
3. Access the site manually:
- Site: http://localhost:8888
- Admin login: admin / password
* Site: <http://localhost:8888>
* Admin login: admin / password
## Testing in WordPress Multisite
@@ -62,10 +63,10 @@ We use `@wordpress/env` and Cypress for testing our plugin.
```
This will:
- Start a WordPress environment using wp-env
- Configure it as a multisite installation
- Create a test subsite
- Network activate our plugin
* Start a WordPress environment using wp-env
* Configure it as a multisite installation
* Create a test subsite
* Network activate our plugin
2. Run Cypress tests for multisite:
```bash
@@ -78,9 +79,9 @@ We use `@wordpress/env` and Cypress for testing our plugin.
```
3. Access the sites manually:
- Main site: http://localhost:8888
- Test subsite: http://localhost:8888/testsite
- Admin login: admin / password
* Main site: <http://localhost:8888>
* Test subsite: <http://localhost:8888/testsite>
* Admin login: admin / password
## Continuous Integration
@@ -111,7 +112,7 @@ Add new multisite tests to `cypress/e2e/multisite.cy.js`.
```bash
# For single site
wp-env run cli wp plugin activate wp-plugin-starter-template-for-ai-coding
# For multisite
wp-env run cli wp plugin activate wp-plugin-starter-template-for-ai-coding --network
```
@@ -119,7 +120,8 @@ Add new multisite tests to `cypress/e2e/multisite.cy.js`.
### Getting Help
If you encounter any issues, please open an issue on our GitHub repository with:
- A description of the problem
- Steps to reproduce
- Any error messages
- Your environment details (OS, Node.js version, etc.)
* A description of the problem
* Steps to reproduce
* Any error messages
* Your environment details (OS, Node.js version, etc.)