Skip to content

Instantly share code, notes, and snippets.

@robneu
Last active December 18, 2015 21:19
Show Gist options
  • Save robneu/5846531 to your computer and use it in GitHub Desktop.
Save robneu/5846531 to your computer and use it in GitHub Desktop.
Get the data out of a repeatable group using the Custom Meta Boxes script from Humanmade
<?php
/**
* Display a repeatable group using the humanmade
* Custom Meta Boxes script
*
* @author FAT Media <http://youneedfat.com>
* @copyright Copyright (c) 2013, FAT Media, LLC
* @license GPL-2.0+
*/
// Get all the post's custom metadata
$repeatable_group = get_post_custom( get_the_ID() );
// Get the fields of the group you need
$fields = $repeatable_group['the_group_name'];
// Loop through the fields and uneseralize them
foreach ( $fields as $field ) {
$rpt = unserialize( $field );
$some_field = $rpt['the_field_name'];
$another_field = $rpt['another_field_name'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment