Skip to content

Instantly share code, notes, and snippets.

@afuggetta
Created June 9, 2015 14:17
Show Gist options
  • Save afuggetta/76a1430b1eb18857b0b4 to your computer and use it in GitHub Desktop.
Save afuggetta/76a1430b1eb18857b0b4 to your computer and use it in GitHub Desktop.
<?php
//Add guest authors metaboxes
add_action( 'add_meta_boxes', array( $this, 'bps_add_metaboxes' ), 10, 2 );
//Adding custom fields to guest authors
add_filter( 'coauthors_guest_author_fields', array( $this, 'bps_filter_guest_author_fields' ), 10, 2 );
/**
* Adding metaboxes
*/
public function bps_add_metaboxes() {
add_meta_box(
'coauthors-manage-guest-author-test-info',
__( 'Add header image', 'co-authors-plus' ),
array( $this, 'bps_metabox_manage_guest_author_test_info' ),
'guest-author',
'normal',
'default'
);
}
public function bps_filter_guest_author_fields( $fields_to_return, $groups ) {
if ( in_array( 'all', $groups ) || in_array( 'name', $groups ) ) {
$fields_to_return[] = array(
'key' => 'job_title',
'label' => 'Job title',
'group' => 'name',
);
}
if ( in_array( 'all', $groups ) || in_array( 'contact-info', $groups ) ) {
$fields_to_return[] = array(
'key' => 'twitter_handle',
'label' => 'Twitter handle (Without @)',
'group' => 'contact-info',
);
}
return $fields_to_return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment