-
Notifications
You must be signed in to change notification settings - Fork 1
Install via Composer
Takahashi Fumiki edited this page May 29, 2023
·
3 revisions
You can use this plugin as a composer library.
If you are a theme developer, this approach might work well.
composer require kunoichi/ga-communicator
From your theme or plugin, include the composer's autoloader.
// This path will be changed depending on your use case.
require __DIR__ . '/vendor/autload.php';
Calling the bootstrap function will register all hooks.
\Kunoichi\GaCommunicator::get_instance();
Now your code is ready to run.
Some tasks are skipped, and global functions are omitted.
If your site is under network, define constant GA_COMMUNICATOR_NETWORK_ACTIVE
to true
before running Bootstrap.
define( 'GA_COMMUNICATOR_NETWORK_ACTIVE', true );
The constant above will affect:
- The setting screen will move to Network Admin > Setting.
- All sites under the network will share the setting.
Composer skips the "popular posts" widget. Register them if you need one.
// Register Widgets.
add_action( 'widgets_init', function() {
register_widget( \Kunoichi\GaCommunicator\Widgets\PopularPosts::class );
} );
The gettext call is skipped. The po file is under languages
directory and load them via locale
method. Only ja
and en_US
is supported.
\Kunoichi\GaCommunicator::get_instance()->locale();