/** * Output the shortcode * * @param array $atts * * @since 1.3.0 * @access public * * @return string */ public function output($atts) { // get shortcode attributes $atts = shortcode_atts(array('id' => get_the_ID(), 'limit' => -1, 'template' => 'related-posts-default.php'), $atts); // output children return rp4wp_children($atts['id'], false, $atts['template'], $atts['limit']); }
public function widget($args, $instance) { // Not on frontpage please if (is_front_page() && false === is_page()) { return; } // Post Link Manager $pl_manager = new RP4WP_Post_Link_Manager(); // Get content $widget_content = rp4wp_children(get_the_ID(), false, 'widget-related-posts-default.php'); // Only display if there's content if ('' != $widget_content) { // Output the widget echo $args['before_widget']; echo $widget_content; echo $args['after_widget']; } }