Created
May 31, 2016 02:02
-
-
Save ChrisFlannagan/1cabe324b70ae0d18921d5277574e62a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* hook into WP's admin_init action hook | |
*/ | |
public function admin_init() { | |
// Here we create our settings fields to be contained in the setting group 'wpfh-group' | |
register_setting( self::PLUGIN_ABBR . '-group', self::PLUGIN_ABBR . '-group' ); | |
add_settings_section ( self::PLUGIN_SLUG . '_main_section' , 'Primary Settings', array( $this, 'settings_callback'), self::PLUGIN_SLUG . '-options' ); | |
//loop through our defined fields and add as a setting field option | |
foreach ( $this->global_field_options as $field => $args ) { | |
add_settings_field( self::PLUGIN_ABBR . '_' . $field, $args['label'], array( $this, $args['admin'] . '_callback' ), self::PLUGIN_SLUG . '-options', self::PLUGIN_SLUG . '_main_section', array( $field, $args['extra'] ) ); | |
} | |
foreach ( $this->stripe_field_options as $field => $args ) { | |
add_settings_field( self::PLUGIN_ABBR . '_' . $field, $args['label'], array( $this, $args['admin'] . '_callback' ), self::PLUGIN_SLUG . '-options', self::PLUGIN_SLUG . '_main_section', array( $field, $args['extra'] ) ); | |
} | |
foreach ( $this->authnet_field_options as $field => $args ) { | |
add_settings_field( self::PLUGIN_ABBR . '_' . $field, $args['label'], array( $this, $args['admin'] . '_callback' ), self::PLUGIN_SLUG . '-options', self::PLUGIN_SLUG . '_main_section', array( $field, $args['extra'] ) ); | |
} | |
foreach ( $this->paypal_field_options as $field => $args ) { | |
add_settings_field( self::PLUGIN_ABBR . '_' . $field, $args['label'], array( $this, $args['admin'] . '_callback' ), self::PLUGIN_SLUG . '-options', self::PLUGIN_SLUG . '_main_section', array( $field, $args['extra'] ) ); | |
} | |
} // END public static function activate | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment