when Reciprocal relationship checked cant change connection

Support MB Relationships when Reciprocal relationship checked cant change connectionResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #27988
    felixwa@gmail.com[email protected]
    Participant

    Hi, I"m trying to make relationship between CPT Work and CPT Press,
    I want to be able to change the connection on both cpt pages and display the results on both single pages.

    If i uncheck "Reciprocal relationship" i see and can change the connection and it's updates on both posts, but when i display in single.php i can see the selection only on single Work.
    on single press i don't see the results. the code i"m using is bellow.

    If i check the Reciprocal relationship, then i see the results on both single pages BUT i don't get the option to change the connection on CPT press - the connection area field appear only on work page.

    I"m using

    $connected = new WP_Query( [
            'relationship' => [
                'id'   => 'art-work-2-press',
                'from' => get_the_ID(), // You can pass object ID or full object
            ],
            'nopaging'     => true,
        ] );
        while ( $connected->have_posts() ) : $connected->the_post();
            ?>
            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
            <?php
        endwhile;
        wp_reset_postdata();

    I"m missing something?
    How can i make changes and display on both pages?

    Thank you
    Felix

    #28002
    Long NguyenLong Nguyen
    Moderator

    Hi Felix,

    You can remove "Reciprocal relationship" and use the query on two single templates.

    • In the single Work, use this code
    $connected = new WP_Query( [
        'relationship' => [
            'id'   => 'art-work-2-press',
            'from' => get_the_ID(), // You can pass object ID or full object
        ],
        'nopaging'     => true,
    ] );
    • In the single Press, use this code
    $connected = new WP_Query( [
        'relationship' => [
            'id'   => 'art-work-2-press',
            'to' => get_the_ID(), // here
        ],
        'nopaging'     => true,
    ] );

    then copy the loop from one template to the other.

    #28011
    felixwa@gmail.com[email protected]
    Participant

    Hi Long
    I understand now.
    Thank you

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