Skip to content

Instantly share code, notes, and snippets.

@alpha1
Last active August 29, 2015 13:57
Show Gist options
  • Save alpha1/9421107 to your computer and use it in GitHub Desktop.
Save alpha1/9421107 to your computer and use it in GitHub Desktop.
Test of filters and adding 'input' in field group for @Alpha's pull request for Co-author's Plus
<?php
if(!function_exists('cap_add_email_privacy_field')){
function cap_add_email_privacy_field( $fields_to_return, $groups ) {
//echo '<pre>';
//print_r($fields_to_return);
//echo '</pre>';
if ( in_array( 'all', $groups ) || in_array( 'contact-info', $groups ) ) {
$fields_to_return['email_privacy'] = array(
'group' => 'contact-info',
'key' => 'email_privacy',
'label' => 'Keep Email Private?',
'type' => 'checkbox',
'input' => 'checkbox',
'callback' =>'cap_email_privacy_cb'
);
}
return $fields_to_return;
}
}
add_filter( 'coauthors_guest_author_fields', 'cap_add_email_privacy_field', 10, 2);
function switch_ep($input){
return "email";
//this turns the checkbox back into an email field...not something we want to do, but just to test
}
add_filter('cap-contact_info-cap-email_privacy', 'switch_ep',50);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment