• Resolved grivitis

    (@grivitis)


    Hi,

    Right now Im using this code in single templates, to show the connected links.

    <?php $connected = new WP_Query( array(
    'connected_type' => 'events_to_location',
    'connected_items' => get_queried_object(), ) );
    if ( $connected->have_posts() ) :?>
    <?php while( $connected->have_posts() ) : $connected->the_post();?>
    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    <?php endwhile;
    wp_reset_postdata();
    endif; ?>

    But this code, doesen’t show anything in archive templates. What code, should I use inseted of this, to display links in archive templates?

    Thank you.

    http://ww.wp.xz.cn/extend/plugins/posts-to-posts/

Viewing 1 replies (of 1 total)
  • Plugin Author scribu

    (@scribu)

    If that code runs in The Loop, you just have to replace get_queried_object() with $post.

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Posts 2 Posts] Show connected links in archive templates’ is closed to new replies.