Last active
December 18, 2015 21:19
-
-
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
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 | |
/** | |
* 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