Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
# Prerequisite post type and meta fields for Recipe 3: Creating Post "Sections"
function recipe_3_prereq() {
register_post_type( 'wordcamp', array(
'public' => true,
'label' => 'WordCamps'
) );
# See http://fieldmanager.org
if ( class_exists( 'Fieldmanager_Field' ) ) {
$fm = new Fieldmanager_Group( array(
'name' => 'Sections',
'tabbed' => true,
'children' => array(
'schedule' => new Fieldmanager_Group( array(
'label' => 'Schedule',
'children' => array(
'content' => new Fieldmanager_RichTextArea()
)
) ),
'speakers' => new Fieldmanager_Group( array(
'label' => 'Speakers',
'children' => array(
'speaker' => new Fieldmanager_Group( array(
'limit' => 0,
'label' => 'New Speaker',
'label_macro' => array( 'Speaker: %s', 'name' ),
'add_more_label' => 'Add another speaker',
'collapsible' => true,
'sortable' => true,
'children' => array(
'name' => new Fieldmanager_TextField( 'Name' ),
'image' => new Fieldmanager_Media( 'Image' ),
'email' => new Fieldmanager_TextField( 'Email' ),
'twitter' => new FieldManager_TextField( 'Twitter Handle (omit the @)' ),
'bio' => new Fieldmanager_RichTextArea( 'Bio' ),
'presentation' => new FieldManager_TextArea( 'Presentation Title', array( 'attributes' => array( 'style' => 'width:100%;height:50px' ) ) )
)
) )
)
) ),
'sponsors' => new Fieldmanager_Group( array(
'label' => 'Sponsors',
'children' => array(
'speaker' => new Fieldmanager_Group( array(
'limit' => 0,
'label' => 'New Sponsor',
'label_macro' => array( 'Sponsor: %s', 'name' ),
'add_more_label' => 'Add another sponsor',
'collapsible' => true,
'sortable' => true,
'children' => array(
'name' => new Fieldmanager_TextField( 'Name' ),
'image' => new Fieldmanager_Media( 'Image' ),
'twitter' => new FieldManager_TextField( 'Twitter Handle (omit the @)' ),
'website' => new FieldManager_TextField( 'Website URL' ),
'description' => new Fieldmanager_RichTextArea( 'Description' )
)
) )
)
) ),
'tickets' => new Fieldmanager_Group( array(
'label' => 'Tickets',
'children' => array(
'content' => new Fieldmanager_RichTextArea()
)
) ),
'location' => new Fieldmanager_Group( array(
'label' => 'Location',
'children' => array(
'address' => new FieldManager_TextField( 'Address or Lat/Long (for Google Map)' ),
'content' => new Fieldmanager_RichTextArea( 'Content' )
)
) )
)
) );
$fm->add_meta_box( __( 'Sections', 'wcpdx' ), 'wordcamp' );
}
}
add_action( 'init', 'recipe_3_prereq' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.