No results found. Try again with different words?

Search must be at least 3 characters.

Add Settings To Extensions Page

To add settings for your extension, you can add these right to the extensions tab of the SureFeedback settings. There’s a neat filter that lets you do this called ph_settings_extensions. Here’s an example:

<?php
// filter plugin settings 
add_filter( 'ph_settings_extensions', 'my_extension_plugin_settings' );

// add our settings
function my_extension_plugin_settings($settings) {
	// add fields

	// divider with title
	$settings['fields'][] = array(
		'id'          => 'highlight_divider',
		'label'       => __( 'JIRA Integration', 'my-text-domain' ),
		'description' => '',
		'type'        => 'divider',
	);

	// see all field types in includes/admin/settings/settings-fields.php
    
    // text box example
	$settings['fields'][] = array(
		'id'          => 'my_extension_text_box',
		'label'       => __( 'A Text Box', 'my-text-domain' ),
		'description' => __( 'This is a description for a text box.', 'my-text-domain' ),
		'type'        => 'text',
		'default'     => '',
		'placeholder' => __( 'Enter some text.', 'my-text-domain' ),
	);
    
    // color picker	
    $settings['fields'][] = array(
	    'id'          => 'my_extension_color',
        'label'       => __( 'Color Picker Example', 'project-huddle' ),
        'description' => __( 'Color picker description.', 'project-huddle' ),
        'type'        => 'color',
        'default'     => '#23282d'
    ),
	
    // checkbox example
	$settings['fields'][] = array(
		'id'          => 'my_extension_checkbox',
        'label'       => __( 'Checkbox Example', 'project-huddle' ),
        'description' => __( 'Checkbox description.', 'project-huddle' ),
        'type'        => 'checkbox',
        'default'     => 'on', // on by default
	);

	return $settings;
}


/**
 * Get our options
 */
$text_box = get_option('ph_my_extension_text_box');
$color    = get_option('ph_my_extension_color');
$checkbox = get_option('ph_my_extension_checkbox');

Then to get your options, use the get_option function with the “ph_” prefix.

Was this article helpful?


Did not find a solution? We are here to help you succeed.

Add Settings To Extensions Page

To add settings for your extension, you can add these right to the extensions tab of the SureFeedback settings. There’s a neat filter that lets you do this called ph_settings_extensions. Here’s an example:

<?php
// filter plugin settings 
add_filter( 'ph_settings_extensions', 'my_extension_plugin_settings' );

// add our settings
function my_extension_plugin_settings($settings) {
	// add fields

	// divider with title
	$settings['fields'][] = array(
		'id'          => 'highlight_divider',
		'label'       => __( 'JIRA Integration', 'my-text-domain' ),
		'description' => '',
		'type'        => 'divider',
	);

	// see all field types in includes/admin/settings/settings-fields.php
    
    // text box example
	$settings['fields'][] = array(
		'id'          => 'my_extension_text_box',
		'label'       => __( 'A Text Box', 'my-text-domain' ),
		'description' => __( 'This is a description for a text box.', 'my-text-domain' ),
		'type'        => 'text',
		'default'     => '',
		'placeholder' => __( 'Enter some text.', 'my-text-domain' ),
	);
    
    // color picker	
    $settings['fields'][] = array(
	    'id'          => 'my_extension_color',
        'label'       => __( 'Color Picker Example', 'project-huddle' ),
        'description' => __( 'Color picker description.', 'project-huddle' ),
        'type'        => 'color',
        'default'     => '#23282d'
    ),
	
    // checkbox example
	$settings['fields'][] = array(
		'id'          => 'my_extension_checkbox',
        'label'       => __( 'Checkbox Example', 'project-huddle' ),
        'description' => __( 'Checkbox description.', 'project-huddle' ),
        'type'        => 'checkbox',
        'default'     => 'on', // on by default
	);

	return $settings;
}


/**
 * Get our options
 */
$text_box = get_option('ph_my_extension_text_box');
$color    = get_option('ph_my_extension_color');
$checkbox = get_option('ph_my_extension_checkbox');

Then to get your options, use the get_option function with the “ph_” prefix.

Leave a Reply

Your email address will not be published. Required fields are marked *

LET’S GET STARTED

Ready to Give It a Try?

Start Your Free 14-Day Trial Now. No Obligation. No Reason Not To.

Trial Icon

14 Days Free Trial

Experience Our Platform Risk-Free

Docs Icon

Documentation

Articles that cover common questions

24/7 World Class Support Team

Friendly Support

Reach Out – We’re Here to Help

Scroll to Top