https://github.com/jessepollak/wordpress-ajax-settings
:computer: Ajaxify the settings for your WordPress plugin — in two lines of code
https://github.com/jessepollak/wordpress-ajax-settings
Last synced: about 1 month ago
JSON representation
:computer: Ajaxify the settings for your WordPress plugin — in two lines of code
- Host: GitHub
- URL: https://github.com/jessepollak/wordpress-ajax-settings
- Owner: jessepollak
- Created: 2014-02-06T02:19:07.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-05-03T03:44:07.000Z (about 9 years ago)
- Last Synced: 2025-04-07T16:40:45.775Z (2 months ago)
- Language: PHP
- Homepage:
- Size: 45.9 KB
- Stars: 36
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Ajax Settings
===================================This library allows you to make your plugin's settings page work entirely over AJAX if you use the WordPress Settings API and follow standard protocols.
# Installation
1. Download the `dist`, rename it 'ajax-settings', and place it in your project tree.
2. Include the `ajax-settings.php` file and initialize appropriately```php
add_action('admin_init', 'initialize_ajax_settings');
function initialize_ajax_settings() {
require_once(PATH_TO_ajax_settings.php);
new AjaxSettings(array(
"options_name" => YOUR_SETTINGS_API_OPTION_NAME,
"base_url" => URL_TO_THE_ajax-settings_FOLDER
));
}
```### Constructor options
* `options_name` (string) - the name of your Settings API option name
* `base_url` (string) - the URL to the base folder for this library. TODO: make this unecessary ([tweet](http://twitter.com/jessepollak) at me if you know how)
* `initialize` (boolean) - whether you want the client side javascript that handles the settings page to be initialized. Set this to false if you want to inherit from these objects and add in additional functionality.# Development
```bash
$ git clone [email protected]:jessepollak/wordpress-ajax-settings.git
$ cd ajax-settings
$ npm install
$ grunt && grunt watch
```