Created
March 5, 2015 10:39
-
-
Save rilwis/452dec0295484a455875 to your computer and use it in GitHub Desktop.
Support to migrating data to a group
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 | |
$data = array( | |
array( | |
'year' => 2013, | |
'title' => 'Test', | |
'wins' => 1, | |
'podiums' => 2, | |
'poles' => 3, | |
'description' => 'test description', | |
), | |
array( | |
'year' => 2014, | |
'title' => 'Test Title 2', | |
'wins' => 1, | |
'podiums' => 2, | |
'poles' => 3, | |
'description' => 'Test Description 2' | |
) | |
); | |
$post_id = 1; | |
$group_id = 'group'; | |
update_post_meta( $post_id, $group_id, $data ); |
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 | |
add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) | |
{ | |
$meta_boxes[] = array( | |
'title' => 'Group Test', | |
'fields' => array( | |
array( | |
'id' => 'group', // Must match $group_id | |
'name' => 'Group', | |
'type' => 'group', | |
'clone' => true, | |
'fields' => array( | |
array( | |
'id' => 'year', | |
'name' => 'Year', | |
'type' => 'text', | |
), | |
array( | |
'id' => 'title', | |
'name' => 'Title', | |
'type' => 'text', | |
), | |
array( | |
'id' => 'wins', | |
'name' => 'Wins', | |
'type' => 'text', | |
), | |
array( | |
'id' => 'podiums', | |
'name' => 'Podiums', | |
'type' => 'text', | |
), | |
array( | |
'id' => 'poles', | |
'name' => 'Poles', | |
'type' => 'text', | |
), | |
array( | |
'id' => 'description', | |
'name' => 'Description', | |
'type' => 'textarea', | |
), | |
), | |
), | |
), | |
); | |
return $meta_boxes; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment