Email me to say thanks. If you can let me know where my plugins are being used 'in the wild' I always appreciate that.
Thanks in advance for your support.
-Justin
get_donate_button() ?>
plugin_label ?>
plugin_slug.'_setting_section',
'Configuration',
array($this, 'print_section_info'),
$this->plugin_slug.'-setting-admin'
);
//add color picker text input field
$field_slug = "background_color";
$field_label = "Background Color:";
$field_id = $this->plugin_slug.'_'.$field_slug;
register_setting($this->plugin_slug.'_option_group', $field_id);
add_settings_field(
$field_id,
$field_label,
array($this, 'create_a_text_input'), //callback function for text input
$this->plugin_slug.'-setting-admin',
$this->plugin_slug.'_setting_section',
array( // The array of arguments to pass to the callback.
"id" => $field_id, //sends field id to callback
"desc" => 'Choose your tooltip background color above', //description of the field (optional)
"default" => '#000000', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
"class" => "motech-color-field" //designate this as color field
)
);
//add color picker text input field
$field_slug = "text_color";
$field_label = "Text Color:";
$field_id = $this->plugin_slug.'_'.$field_slug;
register_setting($this->plugin_slug.'_option_group', $field_id);
add_settings_field(
$field_id,
$field_label,
array($this, 'create_a_text_input'), //callback function for text input
$this->plugin_slug.'-setting-admin',
$this->plugin_slug.'_setting_section',
array( // The array of arguments to pass to the callback.
"id" => $field_id, //sends field id to callback
"desc" => 'Choose your tooltip text color above', //description of the field (optional)
"default" => '#ffffff', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
"class" => "motech-color-field" //designate this as color field
)
);
//add text input field
$field_slug = "max_width";
$field_label = "Max Width:";
$field_id = $this->plugin_slug.'_'.$field_slug;
register_setting($this->plugin_slug.'_option_group', $field_id);
add_settings_field(
$field_id,
$field_label,
array($this, 'create_a_text_input'), //callback function for text input
$this->plugin_slug.'-setting-admin',
$this->plugin_slug.'_setting_section',
array( // The array of arguments to pass to the callback.
"id" => $field_id, //sends field id to callback
"desc" => 'Set the maximum pixel width of the tooltip bubble. Default is 250.', //description of the field (optional)
"default" => '250', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
)
);
//add text input field
$field_slug = "opacity";
$field_label = "Opacity:";
$field_id = $this->plugin_slug.'_'.$field_slug;
register_setting($this->plugin_slug.'_option_group', $field_id);
add_settings_field(
$field_id,
$field_label,
array($this, 'create_a_text_input'), //callback function for text input
$this->plugin_slug.'-setting-admin',
$this->plugin_slug.'_setting_section',
array( // The array of arguments to pass to the callback.
"id" => $field_id, //sends field id to callback
"desc" => 'Set the opacity of the tooltip bubble. This should be a number between 0 and 1. 0 makes the bubble invisible and 1 makes the bubble totally solid. Default is .95', //description of the field (optional)
"default" => '.95', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
)
);
//add select input field
$field_slug = "position";
$field_label = "Position:";
$field_id = $this->plugin_slug.'_'.$field_slug;
$options = array(
array("label" => "Center", "value" => "center"),
array("label" => "Left", "value" => "left"),
array("label" => "Right", "value" => "right"),
);
register_setting($this->plugin_slug.'_option_group', $field_id);
add_settings_field(
$field_id,
$field_label,
array($this, 'create_a_select_input'), //callback function for radio input
$this->plugin_slug.'-setting-admin',
$this->plugin_slug.'_setting_section',
array( // The array of arguments to pass to the callback.
"id" => $field_id, //sends select field id to callback
"desc" => 'The tooltip\'s position, relative to the trigger element.', //description of the select field (optional)
"default" => 'center', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
"select_options" => $options //sets select option data
)
);
//add checkbox field
$field_slug = "disable_on_mobile";
$field_label = "Disable On Mobile";
$field_id = $this->plugin_slug.'_'.$field_slug;
register_setting($this->plugin_slug.'_option_group', $field_id);
add_settings_field(
$field_id,
$field_label,
array($this, 'create_a_checkbox'), //callback function for checkbox
$this->plugin_slug.'-setting-admin',
$this->plugin_slug.'_setting_section',
array( // The array of arguments to pass to the callback.
"id" => $field_id, //sends field id to callback
"desc" => 'Check this box to disable tooltips on mobile devices.', //description of the field (optional)
"default" => '0' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
)
);
//add text input field
$field_slug = "menu_selectors";
$field_label = "Menu Selectors (Advanced):";
$field_id = $this->plugin_slug.'_'.$field_slug;
register_setting($this->plugin_slug.'_option_group', $field_id);
add_settings_field(
$field_id,
$field_label,
array($this, 'create_a_text_input'), //callback function for text input
$this->plugin_slug.'-setting-admin',
$this->plugin_slug.'_setting_section',
array( // The array of arguments to pass to the callback.
"id" => $field_id, //sends field id to callback
"desc" => 'This is for advanced users. If you want to use the tooltips on your WordPress menus, you can enable this by entering in the css selectors for your menus. For example, if your menu has the class "nav_menu", enter in ".nav_menu" to enable tooltips for all menus where class="nav_menu". You can enter multiple selectors in a comma seperated list. If you don\'t know what this means, or you don\'t want tooltips on your menus, just leave it empty. Get Help »', //description of the field (optional)
"default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
)
);
} //end of page_init function
/**
* This following set of functions handle all input field creation
*
*/
function create_a_checkbox($args) {
$html = '';
// Here, we will take the desc argument of the array and add it to a label next to the checkbox
$html .= '';
echo $html;
} // end create_a_checkbox
function create_a_text_input($args) {
//grab placeholder if there is one
if(isset($args["placeholder"])) {
$placeholder_html = "placeholder=\"".$args['placeholder']."\"";
} else {
$placeholder_html = "";
}
if(!empty($args["class"])){
$class = $args["class"];
}else{
$class = "";
}
// Render the output
echo '';
if(isset($args["desc"])) {
echo "
".$args["desc"]."
";
}
} // end create_a_text_input
function create_a_textarea_input($args) {
//grab placeholder if there is one
if($args[placeholder]) {
$placeholder_html = "placeholder=\"".$args[placeholder]."\"";
}
// Render the output
echo '';
if($args[desc]) {
echo "