Created
February 18, 2019 11:46
-
-
Save barrykooij/9dcb4c4b26e3bd4f9af243940a7e2bb9 to your computer and use it in GitHub Desktop.
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 | |
$child_posts = Post_Connector::API()->get_children( "course", get_the_id() ); | |
$parent_posts = Post_Connector::API()->get_parents( "course", get_the_id() ); | |
$my_connected_posts = array_merge( $child_posts, $parent_posts ); | |
// 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