Display Relationship in Oxygen

Support MB Relationships Display Relationship in OxygenResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #39835
    JoeJoe
    Participant

    Hi,

    I am using Oxygen. I have been up for a long time, maybe that's why I don't see str8.
    This is my problem :
    CPT called : event
    CPT called: person

    I have setup a relationship between the two and the relationshsip works. I want to display the events using a repeater and show the name of the person underneath it.

    repeater works, and I also get an output, BUT it only show me the ID of the person, and not the name ? I can also have the url displayed, that works also, But how do I get to the name , which is the title of the post (cpt person)

    #39843
    JoeJoe
    Participant

    Hi,
    I just found out how to do it, here for whoever has the same problem,
    just add a codeblock in the repeater and add the following :

    <?php
    	$connected = new WP_Query( [
        'relationship' 	=> [
            'id'   		=> 'add-here-the-id-of-your-relationship',
            'to' 		=> get_the_ID(),],
        'nopaging'		=> true,
    ] );
    while ( $connected->have_posts() ) : $connected->the_post();
        ?>
        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    <?php
    		endwhile;
    		wp_reset_postdata();
    ?>
    #39886
    PeterPeter
    Moderator

    Hello,

    Thanks for sharing the solution.

    I also would like to say that, in case of using Oxygen Builder, please reach out to them if you have any issues with installation, configuration, compatibility, or usage.
    Refer to our support policy https://metabox.io/support/topic/support-policy/

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