Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $prefix = '_sitename_';
- $year_select_array = array();
- for ($i=date('Y')+1; $i >= 1900 ; $i--) {
- $year_select_array[$i] = $i;
- }
- $default_text_field_columns = 200; //the max width will fix it if it's too big
- $meta_boxes[] = array(
- 'id' => 'reference-citation',
- 'title' => 'Citation',
- 'post_types' => 'reference',
- 'context' => 'after_editor',
- 'priority' => 'high',
- 'fields' => array(
- array(
- 'name' => 'Publication Type',
- 'id' => $prefix . 'publication_type',
- 'type' => 'select',
- // Array of 'value' => 'Label' pairs
- 'options' => array(
- 'article' => 'Article',
- 'book' => 'Book',
- 'book-chapter' => 'Book Chapter',
- 'presentation' => 'Presentation',
- ),
- // Placeholder text
- 'std' => 'article',
- ),
- array(
- 'name' => 'Title',
- 'id' => $prefix . 'article_title',
- 'type' => 'text',
- 'size' => $default_text_field_columns,
- 'desc' => 'Add article, chapter or presentation title',
- 'visible' => array(
- 'when' => array(
- array( $prefix . 'publication_type', '=', 'article'),
- array( $prefix . 'publication_type', '=', 'book-chapter'),
- array( $prefix . 'publication_type', '=', 'presentation')
- ),
- 'relation' => 'or'
- )
- ),
- array(
- 'name' => 'Publication Title',// Book title, or Journal title
- 'desc' => 'Add journal or book title',
- 'id' => $prefix . 'publication_title',
- 'type' => 'text',
- 'size' => $default_text_field_columns,
- 'visible' => array(
- 'when' => array(
- array( $prefix . 'publication_type', '=', 'article'),
- array( $prefix . 'publication_type', '=', 'book'),
- array( $prefix . 'publication_type', '=', 'book-chapter'),
- ),
- 'relation' => 'or'
- )
- ),
- array(
- 'name' => 'Author(s)',
- 'id' => $prefix . 'author',
- 'type' => 'text',
- 'size' => $default_text_field_columns
- ),
- array(
- 'id' => $prefix . 'editor',
- 'type' => 'text', // New HTML 5 input type
- 'name' => 'Editors(s)',
- 'size' => $default_text_field_columns,
- 'visible' => array( $prefix . 'publication_type', '=', 'book-chapter'),
- ),
- array(
- 'id' => $prefix . 'publisher',
- 'type' => 'text', // New HTML 5 input type
- 'name' => 'Publisher',
- 'size' => $default_text_field_columns,
- 'visible' => array(
- 'when' => array(
- array( $prefix . 'publication_type', '=', 'book'),
- array( $prefix . 'publication_type', '=', 'book-chapter'),
- ),
- 'relation' => 'or'
- )
- ),
- array(
- 'name' => 'Publication City',
- 'desc' => 'Add the city where the publisher is based or where the presentation took place',
- 'id' => $prefix . 'publication_city',
- 'type' => 'text',
- 'size' => $default_text_field_columns,
- 'visible' => array(
- 'when' => array(
- array( $prefix . 'publication_type', '=', 'book'),
- array( $prefix . 'publication_type', '=', 'book-chapter'),
- array( $prefix . 'publication_type', '=', 'presentation'),
- ),
- 'relation' => 'or'
- )
- ),
- array(
- 'id' => $prefix . 'volume_issue_number',
- 'type' => 'fieldset_text', // New HTML 5 input type
- 'name' => 'Volume(Issue)',
- 'class' => 'volume-issue-fieldset',
- 'options' => array(
- 'volume' => 'Volume',
- 'issue' => 'Issue',
- ),
- 'visible' => array($prefix . 'publication_type', '=', 'article'),
- ),
- array(
- 'id' => $prefix . 'page_number',
- 'type' => 'text', // New HTML 5 input type
- 'name' => 'Page Number(s)',
- 'size' => $default_text_field_columns,
- 'visible' => array(
- 'when' => array(
- array( $prefix . 'publication_type', '=', 'article'),
- array( $prefix . 'publication_type', '=', 'book-chapter'),
- ),
- 'relation' => 'or'
- )
- ),
- array(
- 'name' => 'Publication year',
- 'id' => $prefix . 'publication_year',
- 'type' => 'select',
- // Array of 'value' => 'Label' pairs
- 'options' => $year_select_array,
- // Placeholder text
- 'placeholder' => 'Select a year',
- ),
- )
- );
- return $meta_boxes;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement