Slideshow demo for Fieldmanager.org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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