Display key_value on front end
-
I’ve got a set of key_value’s that I’d like to use to create buttons on the front end, allowing my client to place both a URL and the title of the button. Backend stuff works fine, but can’t figure out how to echo out the key_value, I just get arrays.
Backend:
array( 'id' => 'links', 'name' =>__('Extra Links','projects'), 'desc' => 'Key is button title, value is the URL. Please include http://', 'type' => 'key_value', ),Front end attempt, this just returns blank.:
$links = rwmb_meta('links'); if ( !empty ( $links ) ) { foreach ( $links as $link ) { echo "<a href='{$link['value']}' class='btn btn-primary btn-block' target='_blank'>{$link['key']}</a>"; } //end links if }Tried this to simplify & troubleshoot:
foreach ( $links as $link ) { echo $link; } //end links ifWhich just echos “Array Array”. Any suggestions? Thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Display key_value on front end’ is closed to new replies.