Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Filter: pmpro_custom_advanced_settings #86

Merged
merged 1 commit into from
Mar 5, 2014
Merged

New Filter: pmpro_custom_advanced_settings #86

merged 1 commit into from
Mar 5, 2014

Conversation

messica
Copy link
Contributor

@messica messica commented Feb 6, 2014

Add new custom fields to Advanced Settings with an array of options. Supports 'text','select', and 'textarea' as field_types.

Example:

function my_advanced_settings() {
    $custom_fields = array(
        'field1' => array(
            'field_name' => 'test1',
            'field_type' => 'text',
            'label' => 'label1',
            'description' => 'description'
        ) ,
        'field2' => array(
            'field_name' => 'tes22',
            'field_type' => 'text',
            'label' => 'label2',
            'description' => 'another descrioption'
        )
    );

    return $custom_fields;
}
add_filter('pmpro_custom_advanced_settings','my_advanced_settings');

Available options:

'field_name' => 'string',  // "id" and "name" attributes
'field_type' => 'string', // type of field
'label' => 'string', // field label
'description' => 'string' // description, shows up under field
'value' => 'string' //default value
'options' => array() // array of options (for select fields)

These values can then be used anywhere like so:

$test1 = pmpro_getOption('custom_test1');

strangerstudios pushed a commit that referenced this pull request Mar 5, 2014
New Filter: pmpro_custom_advanced_settings
@strangerstudios strangerstudios merged commit 30fa9b9 into strangerstudios:master Mar 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants