-
Notifications
You must be signed in to change notification settings - Fork 21
Features & Customization
I tried to include many examples in this plugin. Depending on your needs, you won't need many of them.
TGM Plugin Activation (TGMPA) is a class that allows you to easily require or recommend other dependent plugins. I mainly included it to prompt the user to download the Carbon Fields Loader if CF is not included with the plugin (via Composer), but you can configure it to require/recommend other plugins as well.
You can modify which plugins it requires/recommends in app/TGMPA.php
. Documentation can be found on Configuring TGMPA page.
- Remove the "tgmpa/tgm-plugin-activation" line from the
composer.json
require section and then runcomposer update
. - Delete the
app/TGMPA.php
file. - Remove the 2 lines that reference TGMPA in
app/Plugin.php
.
In case you don't need/want the extra overhead of Carbon Fields and just want a simple settings page, I have included an example of the WordPress Settings API Class (WPSAC).
- Remove the "tareq1988/wordpress-settings-api-class" line from the
composer.json
require section and then runcomposer update
. - Delete the
app/Settings/WPSAC_Page.php
file. - Remove/comment the
new Settings\WPSAC_Page();
line fromapp/Plugin.php
.
Carbon Fields is useful for creating custom fields, metaboxes and plugin settings pages. If you just want a basic settings page without the extra overhead, there is an example of using WPSAC instead.
If you don't need Carbon Fields and/or want to use something else, you can do the following:
- Remove all lines from
app/
that referenceCarbon_Fields
. -
app/Plugin.php
:- Remove/comment the
new Settings\Carbon_Page();
line fromapp/Plugin.php
. - Modify the
init()
function to remove checking for Carbon Fields. - Remove the
verify_dependencies( 'carbon_fields' )
line from theload_plugin()
function.
- Remove/comment the
Important Note: This plugin makes extensive use of Carbon Fields in its examples, so you will have to remove/change those as well. Basically, refresh the plugin and replace/remove/comment out any errors.
The Serialized Datastore allows you to store option field values as a serialized array instead of multiple database rows.
An example of using it with a complex field type is provided in app/Settings/Carbon_Page.php
(search for "Serialized_Theme_Options_Datastore").
- Remove the "Carbon_Fields\Datastore\Datastore\" line from the
composer.json
autoload section and then runcomposer update
. - Delete the
app/Datastores
directory. - Remove all lines from
app/Settings/Carbon_Page.php
that reference "Serialized_Theme_Options_Datastore".