Skip to content

Instantly share code, notes, and snippets.

@rilwis

rilwis/add-data.php

Created Mar 5, 2015
Embed
What would you like to do?
Support to migrating data to a group
<?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 );
<?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
You can’t perform that action at this time.