__( 'Display the related posts from current post\'s categories. Will appear on single posts only.','arbitragex' ) ) ); } public function form( $instance ) { $defaults = array( 'title_lenght' => 7, 'comment_num' => 1, 'date' => 1, 'show_thumb6' => 1, 'box_layout' => 'horizontal-small', 'show_excerpt' => 0, 'excerpt_length' => 10 ); $instance = wp_parse_args((array) $instance, $defaults); $title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : __( 'Related Posts','arbitragex' ); $title_length = isset( $instance[ 'title_length' ] ) ? intval( $instance[ 'title_length' ] ) : 7; $qty = isset( $instance[ 'qty' ] ) ? esc_attr( $instance[ 'qty' ] ) : 5; $comment_num = isset( $instance[ 'comment_num' ] ) ? esc_attr( $instance[ 'comment_num' ] ) : 1; $date = isset( $instance[ 'date' ] ) ? esc_attr( $instance[ 'date' ] ) : 1; $show_thumb6 = isset( $instance[ 'show_thumb6' ] ) ? esc_attr( $instance[ 'show_thumb6' ] ) : 1; $box_layout = $instance['box_layout']; $show_excerpt = isset( $instance[ 'show_excerpt' ] ) ? esc_attr( $instance[ 'show_excerpt' ] ) : 1; $excerpt_length = isset( $instance[ 'excerpt_length' ] ) ? intval( $instance[ 'excerpt_length' ] ) : 10; ?>

'; $close_li_item = '
'; } else { $thumbnail = 'widgetfull'; $open_li_item = '
  • '; $close_li_item = '
  • '; } global $post; $thePostID = $post->ID; $cats = get_the_category($thePostID); $cat_ids = array(); foreach($cats as $individual_cat) $cat_ids[] = $individual_cat->cat_ID; $posts = new WP_Query( array( 'category__in' => $cat_ids, 'post__not_in' => array($thePostID), 'posts_per_page' => $qty, 'orderby' => 'rand' )); echo '