Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Should be able to just fetch the meta value associated with it, and then either grab the part you need out of the returned value, or do a foreach loop on the whole thing and stop the loop after you’ve finished the first item.

    I believe they all get stored in the same post meta field, so you’ll need some way to isolate what you want.

    Thread Starter Prydonian

    (@prydonian)

    I used

    <?php
    $swfentries = get_post_meta( get_the_ID(), '_cmbdigitalswf_digitalswf', true );
    foreach ( (array) $swfentries as $key => $swfentry ) {
    	$swftitle = $swfdescription = $swfwidth = $swfheight = $swf = '';
    	if ( isset( $swfentry['swftitle'] ) )
    		$swftitle = esc_html( $swfentry['swftitle'] );
    	if ( isset( $swfentry['swfdescription'] ) )
    		$swfdescription = esc_html( $swfentry['swfdescription'] );
    	if ( isset( $swfentry['swfwidth'] ) )
    		$swfwidth = esc_html( $swfentry['swfwidth'] );
    	if ( isset( $swfentry['swfheight'] ) )
    		$swfheight = esc_html( $swfentry['swfheight'] );
    	if ( isset( $swfentry['swf'] ) )
    		$swf = esc_html( $swfentry['swf']);
    	if ($key == 0) {
    ?>
    // Do stuff
    <?php
    	}
    }
    ?>

    Which worked a treat.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    You could also use a break; after you’ve fetched a complete entry needed, and that would/should eliminate the need to check the $key index.

    Thread Starter Prydonian

    (@prydonian)

    Good point, thanks.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Repeatable group get the first entry only’ is closed to new replies.