Add placeholder files for multisite functionality
This commit is contained in:
24
includes/Multisite/README.md
Normal file
24
includes/Multisite/README.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Multisite Support
|
||||||
|
|
||||||
|
This directory contains placeholder files for multisite-specific functionality. When developing a plugin based on this template, you can extend these files or create additional classes in this directory to implement multisite features.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To implement multisite-specific functionality:
|
||||||
|
|
||||||
|
1. Create your multisite-specific classes in this directory
|
||||||
|
2. Load and initialize these classes in your main plugin file when in a multisite environment:
|
||||||
|
|
||||||
|
```php
|
||||||
|
// Load multisite support classes if in multisite environment
|
||||||
|
if ( is_multisite() ) {
|
||||||
|
require_once WP_PLUGIN_STARTER_TEMPLATE_PATH . 'includes/Multisite/class-your-multisite-class.php';
|
||||||
|
|
||||||
|
// Initialize multisite support
|
||||||
|
$your_multisite_class = new WPALLSTARS\PluginStarterTemplate\Multisite\Your_Multisite_Class();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
For information on testing your plugin in a multisite environment, see the [Testing Framework](.wiki/Testing-Framework.md) documentation.
|
||||||
53
includes/Multisite/class-multisite-example.php
Normal file
53
includes/Multisite/class-multisite-example.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Multisite Example Class
|
||||||
|
*
|
||||||
|
* This is a placeholder file for multisite-specific functionality.
|
||||||
|
* Extend this file or create additional classes in this directory
|
||||||
|
* to implement multisite features for your plugin.
|
||||||
|
*
|
||||||
|
* @package WPPluginStarterTemplate
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace WPALLSTARS\PluginStarterTemplate\Multisite;
|
||||||
|
|
||||||
|
// Exit if accessed directly.
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Multisite_Example
|
||||||
|
*
|
||||||
|
* Example class for multisite-specific functionality.
|
||||||
|
*/
|
||||||
|
class Multisite_Example {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
// This is just a placeholder class.
|
||||||
|
// Add your multisite-specific initialization here.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example method for multisite functionality.
|
||||||
|
*
|
||||||
|
* @return bool Always returns true.
|
||||||
|
*/
|
||||||
|
public function is_multisite_compatible() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example method to get all sites in the network.
|
||||||
|
*
|
||||||
|
* @return array An empty array as this is just a placeholder.
|
||||||
|
*/
|
||||||
|
public function get_network_sites() {
|
||||||
|
// This is just a placeholder method.
|
||||||
|
// In a real implementation, you might use get_sites() or a custom query.
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,6 +41,7 @@ define( 'WP_PLUGIN_STARTER_TEMPLATE_VERSION', '0.1.13' );
|
|||||||
require_once WP_PLUGIN_STARTER_TEMPLATE_PATH . 'includes/class-plugin.php';
|
require_once WP_PLUGIN_STARTER_TEMPLATE_PATH . 'includes/class-plugin.php';
|
||||||
|
|
||||||
// Plugin is multisite compatible - see .wiki/Testing-Framework.md for testing instructions
|
// Plugin is multisite compatible - see .wiki/Testing-Framework.md for testing instructions
|
||||||
|
// For multisite-specific functionality, see the includes/Multisite directory
|
||||||
|
|
||||||
// Initialize the plugin and store the instance in a global variable.
|
// Initialize the plugin and store the instance in a global variable.
|
||||||
$wpst_plugin = new WPALLSTARS\PluginStarterTemplate\Plugin( __FILE__, WP_PLUGIN_STARTER_TEMPLATE_VERSION );
|
$wpst_plugin = new WPALLSTARS\PluginStarterTemplate\Plugin( __FILE__, WP_PLUGIN_STARTER_TEMPLATE_VERSION );
|
||||||
|
|||||||
Reference in New Issue
Block a user