Skip to content

Instantly share code, notes, and snippets.

@wpmark
Created December 23, 2014 15:42
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 wpmark/99273d700021bc8962d6 to your computer and use it in GitHub Desktop.
Save wpmark/99273d700021bc8962d6 to your computer and use it in GitHub Desktop.
Add new Fields to WP Broadbean
<?php
/**
* function wpmark_add_wpbb_fields()
* @param (array) $fields is an array of current fields in the filter
* @return (array) $fields is the newly modified array of fields
*
* each array passed here should contain the following:
* array(
* 'name' => 'the label given to the field used in the admin',
* 'id' => 'meta key used when saving the data as post meta - should be prefixed with _wpbb_job_',
* 'type' => 'input type to use for outputting the metabox e.g. text, select, textarea etc.
* 'options' => 'an array of value/name options for select box types
* 'bb_field' => 'the XML node which should be used from the Broadbean XML field to populate this field with data
* 'cols' => 'used for layout in the admin meta box - 12 column grid
* 'desc' => 'a field description shown in the meta box under the field
* )
*/
function wpmark_add_wpbb_fields( $fields ) {
/* add our new field */
$fields[ 'internal_ref' ] = array(
'name' => 'Internal Reference',
'id' => '_wpbb_job_internal_reference',
'bb_field' => 'internal_ref',
'type' => 'text',
'cols' => 12
);
return $fields;
}
add_filter( 'wpbb_job_fields', 'wpmark_add_wpbb_fields', 20 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment