ID ); if ( $tags ) { $first_tag = $tags[0]->term_id; $args = array( 'tag__in' => array( $first_tag ), 'post__not_in' => array( $post->ID ), 'posts_per_page' => 2, 'caller_get_posts' => 1 ); $loop = new WP_Query( $args ); if ( $loop->have_posts() ) : echo '
'; while ( $loop->have_posts() ) : $loop->the_post(); ?>

'; else : $args = array( 'orderby' => 'rand', 'ignore_sticky_posts' => true, 'posts_per_page' => 2 ); $loop = new WP_Query( $args ); if ( $loop->have_posts() ) : echo '
'; while ( $loop->have_posts() ) : $loop->the_post(); ?> '; endif; endif; wp_reset_query(); // Else, display two random articles } else { $args = array( 'orderby' => 'rand', 'ignore_sticky_posts' => true, 'posts_per_page' => 2 ); $loop = new WP_Query( $args ); if ( $loop->have_posts() ) : echo '
'; while ( $loop->have_posts() ) : $loop->the_post(); ?> '; endif; wp_reset_query(); } ?>