Relationship WP_Query for Oxygen Builder [Repeater] component

Support MB Relationships Relationship WP_Query for Oxygen Builder [Repeater] componentResolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #30005
    dpdp
    Participant

    this can be easily done with mb views but for a reason, need oxygenbuilder repeater component to visually layout each field.

    pls see screenshot -> https://pasteboard.co/KeLh62g.png

    what should be entered in the manual wp_query field?

    #30010
    Long NguyenLong Nguyen
    Moderator

    Hi,

    I'm not sure how the query of Oxygen Builder works but you can check the query param to get the relationship here https://docs.metabox.io/extensions/mb-relationships/#posts

    #30027
    dpdp
    Participant

    I created a relationship between post to expert (post cpt). Author will create a expert that will link/relate to a post.

    I'm trying to display the linked/related posts on the author archive page.

    Im using the tutorial from metabox doc but getting a Invalid argument supplied for foreach() error.

    sample

    <?php
    
    $auid = get_the_author_meta( 'ID' );
    
    $args = array(
        'author' => '$auid',
        'post_type' => 'post'
        );
    
    $my_query = new WP_Query( $args );
    
    MB_Relationships_API::each_connected( [
        'id'   => 'expert-challenge',
        'to' => $my_query->posts, // Set to $my_query.
    ] );
    
    while ( $my_query->have_posts() ) : $my_query->the_post();
    
        // Display connected pages
        foreach ( $post->connected as $p ) :
          echo $p->post_title;
    
            // More code here.
        endforeach;
    
          echo '<pre>'; var_dump($my_query->posts) ; echo '</pre>';
          
    endwhile;
    //wp_reset_postdata();
    
    
    #30049
    dpdp
    Participant

    resolved. pls close this

    #31800
    KhairulKhairul
    Participant

    Sorry to revived old thread, but how do you solve this?

    Did you find the solution to display MB relationship with Oxygen repeater?

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.