Skip to content

Instantly share code, notes, and snippets.

@netaustin
Created April 20, 2013 14:41
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 netaustin/5426205 to your computer and use it in GitHub Desktop.
Save netaustin/5426205 to your computer and use it in GitHub Desktop.
<?php
// using Fieldmanager for a slideshow - any number of slides, with any number of related links
add_action( 'init', function() {
$fm = new Fieldmanager_Group( array(
'name' => 'slideshow',
'limit' => 0,
'label' => 'New Slide',
'label_macro' => array( 'Slide: %s', 'title' ),
'add_more_label' => 'Add another slide',
'collapsed' => True,
'children' => array(
'title' => new Fieldmanager_Textfield( 'Slide Title' ),
'slide' => new Fieldmanager_Media( 'Slide' ),
'description' => new Fieldmanager_RichTextarea( 'Description' ),
'posts' => new Fieldmanager_Autocomplete( 'Related Posts', array(
'limit' => 0,
'one_label_per_item' => False,
'add_more_label' => 'Add another related link',
'datasource' => new Fieldmanager_Datasource_Post( array(
'query_args' => array(
'post_status' => 'any',
),
) ),
) ),
),
) );
$fm->add_meta_box( 'Slides', array( 'post' ) );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment