function get_repeater_data(){ $repeater = get_post_meta( get_the_ID(), 'repeater_name', true ); $result = array(); foreach ($repeater as $item => $repeater_item) { foreach ($repeater_item as $field => $value) { if ($field == 'repeater_field') { array_shift($result, $repeater_item); $current = $value; array_push($result, $value); } } } return $result[repeater_index]; } add_shortcode( 'repeater_data', 'get_repeater_data' );
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter