Support

Account

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