underpin / exporter-loader
Exporter loader for Underpin
1.1.0
2021-11-24 21:42 UTC
Requires
- underpin/underpin: ^2.0
This package is auto-updated.
Last update: 2024-11-25 04:21:14 UTC
README
Loader That assists with adding GDPR-compliant exporters to a WordPress website.
Installation
Using Composer
composer require underpin/exporter-loader
Manually
This plugin uses a built-in autoloader, so as long as it is required before Underpin, it should work as-expected.
require_once(__DIR__ . '/underpin-exporters/exporters.php');
Setup
- Install Underpin. See Underpin Docs
- Register new exporters menus as-needed.
Example
A very basic example could look something like this.
// Register exporter underpin()->exporters()->add( 'exporter', [ 'id' => 'example-exporter', // required 'name' => __( 'translate-able name', 'domain' ), // required 'get_data_callback' => '__return_empty_array', // Required. See Exporter::get_data 'get_items_callback' => '__return_true', // Required. See Exporter::get_items ] );
Alternatively, you can extend Exporter
and reference the extended class directly, like so:
underpin()->exporters()->add('exporter-key','Namespace\To\Class');