Skip to content

Instantly share code, notes, and snippets.

@barrykooij
Last active December 15, 2017 12:39
Show Gist options
  • Save barrykooij/6b0a945c36e1ea54d7773482fad8f8dc to your computer and use it in GitHub Desktop.
Save barrykooij/6b0a945c36e1ea54d7773482fad8f8dc to your computer and use it in GitHub Desktop.
<?php
/**
* Setup some data
*/
// get the post type
$post_type = get_post_type( get_the_id() );
// The settings object
$pt_settings = RP4WP()->settings[ 'general_' . $post_type ];
/**
* Get the children
*/
$plm = new RP4WP_Post_Link_Manager();
$children = $plm->get_children( get_the_id() );
/**
* @todo count amount of $children and fill up with manually set or random posts of current category
*/
/**
* loop and display
*/
if ( count( $children ) > 0 ) {
// Manager Template
$manager_template = new RP4WP_Manager_Template();
// Load the template output
$manager_template->get_template( $template, array(
'related_posts' => $children,
'heading_text' => $pt_settings->get_option( 'heading_text' ),
'excerpt_length' => $pt_settings->get_option( 'excerpt_length' ),
'post_type' => $post_type
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment