Home Forums Add-ons Repeater Field reverse querying and repeater field


reverse querying and repeater field

  • I am having a problem getting the second row of a repeater field in a reverse query.

    I have this code that gets the id qualiteutilise_0_qualite (repeater field and subfield) from modele (custom post type) .
    This works fine. Except I have multiple repeater fields (qualiteutilise). How can I get qualiteutilise_1_qualite, qualiteutilise_2_qualite etc…

    I need to somehow be able to loop through them but i am not sure how to achieve this. I hope someone can shed some light… thanks for this plugin.

    $modeles = get_posts(
    	'post_type' => 'modele',
    	'meta_query' => array(
    		'key' => 'qualiteutilise_0_qualite', // name of custom field
    		'value' => '"' . get_the_ID() . '"', 
    		'compare' => 'LIKE'
    <?php if( $modeles ): ?>
    <?php foreach( $modeles as $modele ): ?>
    <?php echo get_the_post_thumbnail( $modele->ID, 'sarlap-150' ); ?>
    <?php endforeach; ?>
    <?php endif; ?>
  • I can just repeat this code and replace

    qualiteutilise_0_qualite with qualiteutilise_1_qualite 

    to get the second line but feel this is not the way forward.

  • This reply has been marked as private.
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘reverse querying and repeater field’ is closed to new replies.