Tagged: field, field parameters, fields, meta-box
- This topic has 1 reply, 2 voices, and was last updated 4 years, 8 months ago by
mcmaster.
Viewing 1 reply thread
-
AuthorPosts
-
-
June 7, 2017 at 2:07 pm #8272
brianeoneillParticipantHi. Just discovered Piklist, and I’m using it to create a theme for podcasters. I’m creating a custom meta box where users can enter details about the music that’s included in an episode.
For each song, the user should be able to add the title, artist, and a URL. This should be a repeater, so the user can add as many songs as needed.
I’m trying this, but it’s not working:
piklist('field', array( 'label' => 'Music', 'description' => 'Add songs from this episode', 'add_more' => true, 'fields' => array( array( 'type' => 'text', 'value' => 'song title', 'field' => 'song_title' ), array( 'type' => 'text', 'value' => 'song artist', 'field' => 'song_artist' ), array( 'type' => 'text', 'value' => 'song url', 'field' => 'song_url' ) ) ));Am I doing something wrong?
-
June 10, 2017 at 6:12 pm #8279
mcmasterMemberHi, @ brianeoneill, you’re on the right track but you’re missing a few pieces.
Your container field needs a type. You may also want to add labels for your sub-fields:
piklist('field', array( 'type' => 'group', // <== needed 'field' => 'music', // <== optional 'label' => 'Music', 'description' => 'Add songs from this episode', 'add_more' => true, 'fields' => array( array( 'type' => 'text', 'value' => 'song title', 'field' => 'song_title' 'label' => 'Title', // <== optional ), array( 'type' => 'text', 'value' => 'song artist', 'field' => 'song_artist' 'label' => 'Artist', // <== optional ), array( 'type' => 'text', 'value' => 'song url', 'field' => 'song_url' 'label' => 'URL', // <== optional ) ) ));See the example here for more details.
-
-
AuthorPosts
Viewing 1 reply thread
- You must be logged in to reply to this topic.