An object-oriented WordPress framework for developers to build entities and relationships.
Charm started on Feb 29, 2020, but is still in its early stages and continuously evolving. If you're curious about how Charm works under the hood, have a look around or take it for a spin in a development environment.
- PHP 8.0 or higher
Open up Terminal and cd
into your project's directory. It's the one with your wp-config.php
file.
Create the mu-plugins
directory (unless it already exists):
mkdir -p wp-content/mu-plugins
Add Charm as a submodule called charm
in the wp-content/mu-plugins
directory:
git submodule add https://github.com/ryansechrest/charm.git wp-content/mu-plugins/charm
Your mu-plugins
directory should now look something like this:
|-- mu-plugins
| |-- charm
| | |-- admin
| | |-- ...
| | |-- wordpress
| | |-- autoloader.php
| | |-- Charm.php
| | |-- cli.php
| | |-- MuPlugin.php
| | |-- plugin.php
| | |-- README.md
Activate Charm by copying plugin.php
into the root of your mu-plugins
directory as _charm.php
, or run:
php wp-content/mu-plugins/charm/cli.php activate
Your mu-plugins
directory should now look something like this:
|-- mu-plugins
| |-- charm
| | |-- admin
| | |-- ...
| | |-- wordpress
| | |-- autoloader.php
| | |-- Charm.php
| | |-- cli.php
| | |-- MuPlugin.php
| | |-- plugin.php
| | |-- README.md
| |-- _charm.php
The reason for the underscore is so that Charm loads as early as possible.
This allows you to use Charm in your plugins, themes, or even other mu-plugins.
You're all set from here!
Charm offers features that can be enabled by editing your _charm.php
file:
Charm::init([
/**
* View cron events and schedules in WordPress admin
*
* Navigate to: Tools > Cron Viewer
*
* true | Enable cron viewer
* false | Disable cron viewer (default)
*/
'cron_viewer' => false,
]);
Update Charm by running:
php wp-content/mu-plugins/charm/cli.php update
Temporarily deactivate Charm by removing _charm.php
, or run:
php wp-content/mu-plugins/charm/cli.php deactivate
Remove all the submodule references and Charm files.
Run the following command:
git submodule deinit wp-content/mu-plugins/charm
-OR- remove the following lines from the .git/config
file:
[submodule "wp-content/mu-plugins/charm"]
url = https://github.com/ryansechrest/charm.git
active = true
Remove the following lines from the .gitmodules
file:
[submodule "wp-content/mu-plugins/charm"]
path = wp-content/mu-plugins/charm
url = https://github.com/ryansechrest/charm.git
Run the following command:
rm -rf .git/modules/wp-content/mu-plugins/charm
-OR- if you have no other submodules in the wp-content
directory:
rm -rf .git/modules/wp-content
Run the following commands:
rm wp-content/mu-plugins/_charm.php
rm -rf wp-content/mu-plugins/charm
Thanks for checking out Charm, and if you have any feedback, I'd love to hear it!
Ƹ̵̡Ӝ̵̨̄Ʒ