Relationship within loop
-
Hi there,
i′m trying to get a relationship field within a loop.
I created a loop called “hotel” and a field “hotel_text” and “hotel_location”.
the “hotel_location” is the relationship-field.
Following code is working if the relationship-field is not within a loop.
—
<?php
$values = CFS()->get(‘hotel_location’);
foreach ($values as $post_id) {
$the_post = get_post($post_id);
echo $the_post->post_title;
}
?>
—What code can i use to get it working within the loop?
I tried the code below, but it just throws out array array.
<?php
$fields = CFS()->get(‘hotel’);
foreach ($fields as $field) {
echo $field[‘hotel_text’];
echo $field[‘hotel_location’];
}
?>Thanks a lot
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Relationship within loop’ is closed to new replies.