Support

Account

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.