Home › Forums › General Issues › Relationship Field table › Reply To: Relationship Field table
i’m new in php and for my problem found solution. but still have problem to show the result in frontend. i need each item write in own row:
please someone check the code and tell me about problem in this code:
<table>
<tr>
<th>heading 1</th>
<th>heading 2</th>
<th>heading 3</th>
<th>heading 4</th>
</tr>
<?php
$posts = get_field('relationship'); //4x post in relationship field linked
if( $posts ): ?>
<?php foreach( $posts as $p ):?>
<tr>
<td>
<a href="<?php echo get_permalink( $p->ID ); ?>"><?php echo get_the_title( $p->ID ); ?></a>
</td>
</tr>
<?php endforeach; ?></table>
<?php endif; ?>
thanks alot
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.