As I mentioned here those 2 ajax actions,
here is how you can use the second action that extracts form values in db format
-
Create an ajax action that will return the settings options
You can add this code to
{theme}/functions.php
or to{theme}/inc/hooks.php
function _action_ajax_fw_theme_get_settings_options() { wp_send_json_success(array( 'options' => fw()->theme->get_settings_options() )); } add_action( 'wp_ajax_fw_theme_get_settings_options', '_action_ajax_fw_theme_get_settings_options' );
-
Open the Theme Settings page and run this script in console
var dbSettingsOptions = { $form: jQuery('.fw-settings-form'), options: null, getOptions: function (callback) { if (this.options) { return callback(this.options); } jQuery.ajax({ url: ajaxurl, type: 'POST', data: 'action=fw_theme_get_settings_options', dataType: 'json', success: _.bind(function (response, status, xhr) { if (!response.success) { alert('Ajax error'); return; } this.options = response.data.options; callback(this.options); }, this), error: function (xhr, status, error) { alert('Ajax error'); } }); }, getValues: function(callback) { if (!this.options) { return this.getOptions(_.bind(function(){ this.getValues(callback); }, this)); } jQuery.ajax({ url: ajaxurl, type: 'POST', data: [ 'action=fw_backend_options_get_values', this.$form.serialize() .replace(/fwf=[^\&]+\&/, ''), // remove special hidden input value to prevent form save 'options="+ encodeURIComponent(JSON.stringify(this.options)) ].join("&'), dataType: 'json', success: _.bind(function (response, status, xhr) { if (!response.success) { alert('Error: '+ response.data.message); return; } callback(response.data.values); }, this), error: function (xhr, status, error) { alert(status +': '+ error.message); } }); } }; dbSettingsOptions.getValues(function(values){ console.log(values); });