function widget($args, $instance) { $instance = array_merge($this->defaults, $instance); $output = P2P_List_Renderer::query_and_render(array('ctype' => $instance['ctype'], 'method' => 'related' == $instance['listing'] ? 'get_related' : 'get_connected', 'item' => get_queried_object(), 'mode' => 'ul', 'context' => 'widget')); if (!$output) { return; } $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); echo $args['before_widget']; if (!empty($title)) { echo $args['before_title'] . $title . $args['after_title']; } echo $output; echo $args['after_widget']; }
private static function get_list($attr, $method) { global $post; $attr = shortcode_atts(array('type' => '', 'mode' => 'ul'), $attr); return P2P_List_Renderer::query_and_render(array('ctype' => $attr['type'], 'method' => $method, 'item' => $post, 'mode' => $attr['mode'], 'context' => 'shortcode')); }