Viewing 1 replies (of 1 total)
  • Thread Starter Elton Baroncello

    (@eltonbaroncello)

    I looked into plugin source and I found a sample that solved my problem.

    I just changed a little bit.

    <?php
    //function.php
    function get_artists_related($postid){
    $artists_relation = rpt_get_object_relation($postid, ‘artistas’);
    if(!empty($artists_relation)) {

    $args = array(
    ‘post_type’ => ‘artistas’,
    ‘post_status’ => ‘publish’,
    ‘posts_per_page’ => -1,
    ‘post__in’ => $artists_relation
    );

    $results_artists = query_posts($args);

    foreach ( $results_artists as $post ) {
    $artistas .= ‘‘.$post->post_title.’‘ ;
    }
    return $artistas;
    }
    }

    ?>

    <?php echo get_artists_related($post->ID); ?>

Viewing 1 replies (of 1 total)
  • The topic ‘How to get the relationship between two custom post types into my theme?’ is closed to new replies.