Hi mitchoyoshitaka, I wrote a customized YARPP multi-widget based on the new widget API of WordPress version2.8. According to design, this widegt should only be presented once current entry has some related items, otherwise it should just not appear, instead of saying "No related entries.", following is the source code in the output section:
function widget( $args, $instance ) {
extract( $args, EXTR_SKIP );
$title = apply_filters('widget_title', $instance['title'] );
if ( related_entries_exist() ) :
echo $before_widget;
if ( $title )
echo "\n\t\t\t" . $before_title . $title . $after_title;
echo related_entries();
echo $after_widget;
endif;
}
But the related_entries_exist() seems always return true, even when related_entries() returns No related entries.
Could you figure out why this happens? Is the related_entries_exist() can only exists in The Loop? Or should I give it an argument of current entry's ID?
I'm sorry to hear of your family emergency, wish you can answer my question when you get back.