Skip to content

Instantly share code, notes, and snippets.

@barrykooij
Created June 5, 2014 07:59
Show Gist options
  • Save barrykooij/0efabcce67d332f65dd4 to your computer and use it in GitHub Desktop.
Save barrykooij/0efabcce67d332f65dd4 to your computer and use it in GitHub Desktop.
Post Connector Example: Display linked posts of current post
<?php
// Get the connected posts
$my_connected_posts = Post_Connector::API()->get_children( "course", get_the_id() );
// Check
if ( count( $my_connected_posts ) > 0 ) {
// Loop
foreach ( $my_connected_posts as $my_connected_post ) {
// Display the title with a link
echo "<a href='" . get_permalink( $my_connected_post->ID ) . "'>" . $my_connected_post->post_title . "</a><br/>";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment