Home › Forums › Add-ons › Repeater Field › Repeater Fields and Relationship Fields › Reply To: Repeater Fields and Relationship Fields
I’ve solved part of the problem with some wpdb queries; now I have to show the subfields wich are in the same row of the relationship field called by the query.
To be more clear:
global $wpdb;
$queries = $wpdb->get_results( "SELECT * FROM wp_postmeta WHERE meta_key LIKE 'key1_%_key2' AND meta_value LIKE '%" . get_the_ID() . "%'");
?>
<?php if( $queries ): ?>
<ul>
<?php foreach( $queries as $query ): ?>
<?php
$photo = get_field('_photo', $query->post_id);
?>
<li>
<a href="<?php echo get_permalink( $query->post_id ); ?>">
<img src="<?php echo $photo?>" width="65" />
<?php echo get_the_title( $query->post_id ); ?>
</a></li>
<?php endforeach; ?>
</ul>
<?php endif;
There is a way to know the index of the row of every selected field, or something that can output the other subfields in the same row automatically? Do you know how I can achieve this? Thank you.
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.