Skip to content

Instantly share code, notes, and snippets.

Created February 23, 2012 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/1895238 to your computer and use it in GitHub Desktop.
Save anonymous/1895238 to your computer and use it in GitHub Desktop.
poor attempt at php
// Find related posts
$related = p2p_type( 'brand_to_product' )->get_related( get_queried_object_id() );
'connected_items' => get_queried_object_id(),
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'asc'
) );
// Display related posts
if ( $related->have_posts() ) :
?>
<?php while ( $related->have_posts() ) : $related->the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br />
<?php endwhile; ?>
<?php
// Prevent weirdness
wp_reset_postdata();
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment