I'm facing a problem where my title is being displayed multiple times.
Using the following code the page title 'News' is displayed 10 times, the same number as the number of posts I've elected to display.
<?php while ( have_posts() ) : the_post();
if( is_singular() ) { ?>
<h1 class="row-title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
<p class="meta">Written By: <?php echo get_the_author() ?><span>•</span><?php the_date(); ?></p>
<?php } else { ?>
<h1 class="row-title"><?php wp_title(); ?></h1>
<?php } endwhile; ?>
However, using this version of code, the latest 10 post titles are displayed instead.
<?php while ( have_posts() ) : the_post();
if( is_singular() ) { ?>
<h1 class="row-title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
<p class="meta">Written By: <?php echo get_the_author() ?><span>•</span><?php the_date(); ?></p>
<?php } else { ?>
<h1 class="row-title"><?php the_title(); ?></h1>
<?php } endwhile; ?>
Any help would be greatly appreciated. Thanks.