Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<?php
/**
* Class for adding a link tracking to the options-general.php page
*/
class Add_Settings_Field {
/**
* Class constructor
*/
public function __construct() {
add_filter( 'admin_init' , array( &$this , 'register_fields' ) );
}
/**
* Add new fields to wp-admin/options-general.php page
*/
public function register_fields() {
register_setting( 'general', 'outbound_tracking', 'esc_attr' );
add_settings_field(
'fav_color',
'<label for="outbound_tracking">' . __( 'Track Outbound Links' , 'outbound_tracking' ) . '</label>',
array( &$this, 'fields_radio' ),
'general'
);
}
/**
* HTML for extra settings
*/
public function fields_radio() {
$value = get_option( 'outbound_tracking', '' );
echo '<input type="radio" id="outbound_tracking_no" name="outbound_tracking" value="no"'.(strlen(esc_attr( $value )) == 0 || esc_attr( $value ) == 'no'?' checked':'' ).' /> No <input type="radio" id="outbound_tracking_yes" name="outbound_tracking" value="yes"'.(esc_attr( $value ) == 'yes'?' checked':'' ).' /> Yes ';
}
}
new Add_Settings_Field();
?>