Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@qstudio
Last active September 29, 2020 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qstudio/8f35ddbbc35bae8c101b0c9625a4dc3b to your computer and use it in GitHub Desktop.
Save qstudio/8f35ddbbc35bae8c101b0c9625a4dc3b to your computer and use it in GitHub Desktop.
// EUD - admin fields ##
\add_filter( 'q/eud/api/admin/fields', [ get_class(), 'api_admin_fields' ], 10, 1 );
/**
* Filter add extra admin fields in EUD plugin
*
* @since 2.0.0
*/
public static function api_admin_fields( $array )
{
// add program
if ( \post_type_exists( 'program' ) ) {
// define ##
$program = [
'title' => \__( 'Programs', 'q-export-user-data' ),
'label' => 'program',
'type' => 'select',
'description' => \__( 'Select the program that you wish to export.', 'q-export-user-data' ),
'label_select' => \__( 'All Programs', 'q-export-user-data' ),
'options' => \get_posts([ // grab all posts of type "program" ##
'post_type' => 'program',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC'
]),
'options_ID' => 'ID',
'options_title' => 'post_title'
];
// add to array ##
array_push( $array, $program );
}
// kick back array to filter ##
return $array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment