Skip to content

Instantly share code, notes, and snippets.

@mboynes
Last active August 29, 2015 14:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mboynes/bbbf4370c36ec865ca9f to your computer and use it in GitHub Desktop.
Slideshow demo for Fieldmanager.org
<?php
// using Fieldmanager for a slideshow - any number of slides,
// with any number of related links
add_action( 'fm_post_post', function() {
$fm = new Fieldmanager_Group( array(
'name' => 'slideshow',
'limit' => 0,
'label' => __( 'New Slide', 'your-domain' ),
'label_macro' => array( __( 'Slide: %s', 'your-domain' ), 'title' ),
'add_more_label' => __( 'Add another slide', 'your-domain' ),
'collapsed' => true,
'sortable' => true,
'children' => array(
'title' => new Fieldmanager_Textfield( __( 'Slide Title', 'your-domain' ) ),
'slide' => new Fieldmanager_Media( __( 'Slide', 'your-domain' ) ),
'description' => new Fieldmanager_RichTextarea( __( 'Description', 'your-domain' ) ),
'posts' => new Fieldmanager_Autocomplete( array(
'label' => __( 'Related Posts', 'your-domain' ),
'limit' => 0,
'sortable' => true,
'one_label_per_item' => false,
'add_more_label' => __( 'Add another related link', 'your-domain' ),
'datasource' => new Fieldmanager_Datasource_Post( array(
'query_args' => array(
'post_status' => 'any',
),
) ),
) ),
),
) );
$fm->add_meta_box( __( 'Slides', 'your-domain' ), 'post' );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment