• Resolved dawnrae

    (@dawnrae)


    I am hoping to use the Hyperlink Output as PHP Array to add links to a page, which I believe will allow me to add code around each value (url, text, target). I have having trouble however, determine how to output the values. Anyone have experience with this and willing to share?

Viewing 1 replies (of 1 total)
  • Thread Starter dawnrae

    (@dawnrae)

    Whew! I figured it out finally. Sharing here in case anyone needs it:

    $my_links = CFS()->get('hyperlink_field_name',$post_id);
    $keys = array_keys($my_links);
    $values = array_values($my_links);
    echo '<a href="'.$values[0].'" target="'.$values[2].'">'.$values[1].'</a>';

    If you wish to include it within a loop:

    $my_links = $cfs->get('loop_field_name', $post_id);
    foreach ($my_links as $field) {
    $keys = array_keys($field['hyperlink_field_name']);
    $values = array_values($field['hyperlink_field_name']);
    echo '<a href="'.$values[0].'" target="'.$values[2].'">'.$values[1].'</a>';
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Echo/Print Values from Hyperlink PHP Array’ is closed to new replies.