Created
June 5, 2014 07:59
-
-
Save barrykooij/0efabcce67d332f65dd4 to your computer and use it in GitHub Desktop.
Post Connector Example: Display linked posts of current post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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