Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $recentPosts = new WP_Query(array('showposts' => 5, 'post_type' => array('artist')));
- p2p_type( 'posts_to_artists' )->each_connected( $recentPosts );
- while( $recentPosts->have_posts() ) : $recentPosts->the_post(); ?>
- //...
- <?
- // Display connected posts
- if ($post->connected) {echo '<ul>';}
- else {echo '<p>This artist has got no connected news items yet</p>';};
- foreach ( $post->connected as $post ) : setup_postdata( $post );
- ?>
- <li><a href="<? the_permalink(); ?>"><? the_title(); ?></a></li>
- <? endforeach;
- if ($post->connected) {echo '</ul>';};
- wp_reset_postdata(); // set $post back to original post
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement