__( 'Display the related posts from current post\'s categories. Will appear on single posts only.','mythemeshop' ) ) ); } public function form( $instance ) { $defaults = array( 'comment_num' => 1, 'date' => 1, 'show_thumb6' => 1, 'show_excerpt' => 1, 'excerpt_length' => 10 ); $instance = wp_parse_args((array) $instance, $defaults); $title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : __( 'Related Posts','mythemeshop' ); $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; $show_excerpt = isset( $instance[ 'show_excerpt' ] ) ? esc_attr( $instance[ 'show_excerpt' ] ) : 1; $excerpt_length = isset( $instance[ 'excerpt_length' ] ) ? intval( $instance[ 'excerpt_length' ] ) : 10; ?>

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 '