• 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 number of posts I’ve selected to show.:

    <?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>&bull;</span><?php the_date(); ?></p>
            <?php } else { ?>
                <h1 class="row-title"><?php wp_title(); ?></h1>
            <?php } ?>
    <?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>&bull;</span><?php the_date(); ?></p>
            <?php } else { ?>
                <h1 class="row-title"><?php the_title(); ?></h1>
            <?php } ?>
    <?php endwhile; ?>

    Any help would be greatly appreciated. Thanks.

Viewing 1 replies (of 1 total)
  • what theme are you using?

    what template files are you referring to?

    please post the full code of those files.

    does this also happen with all plugins deactivated?

Viewing 1 replies (of 1 total)
  • The topic ‘Title in the loop displays multiple times’ is closed to new replies.