News repeating

Hi!

I’m currently having a problem with a website i’m working on which uses roots.

I’m setting up a fully blown new website, but until I’m ready to launch, I just want to run the new theme and install showing nothing but news, but I’m having issues with Roots.

The website I’m working with is http://www.news.chessingtonbuzz.co.uk/

The issue I’m having is that my content.php seems to duplicate itself.

Is there anyone here who has any idea as to what’s causing this, as I’ve been racking my mind over it for a little while now and I’m struggling to understand just why it’s doing it.

Thanks for taking the time to read this and perhaps help.

Cheers!

Jared

I can’t see any duplication at the link you’ve posted. It may also help if you post/link to your code.

I don’t see anything wrong either with duplications… posting code or a screenshot of what you’re seeing might help.

I’m sure you’re still working on it - but you might want to adjust the line-height on your span.major for the headings (and maybe make them into heading tags) because they’re collapsing on mobile. Screenshot: http://cl.ly/image/2d0K3q1T2Y40

Hey!

I’ve managed to work out that the number of news items shown setting in Wordpress was duplicating the content.php file, which has now been fixed and modified. But I now have another issue as shown here.

Home Page: http://prntscr.com/1xv7in

News Page: http://prntscr.com/1xv7l9

As you can see, when it’s on the news page, the news shows up correctly using the <!-more-> wordpress feature, but it’s not working on the home page. Now, I have put the code of my content.php page below, and it is exactly the same as that on my news page. I can’t quite fathom why it’s different. Would anyone have any ideas?

<?php
	$args = array('posts_per_page' => 2);
	$myposts = get_posts( $args );
	foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
					
<div class="block">

	<div class="title"><a href="<?php the_permalink(); ?>" class="news"><span class="major"><?php the_title(); ?></span></a></div>

	<?php if (has_post_thumbnail( $post->ID ) ): ?>
	<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
	<a href="<?php the_permalink(); ?>" class="news" title="<?php the_title(); ?>"><img src="<?php echo $image[0]; ?>" alt="<?php the_title(); ?>" class="news"></a>
	<?php endif; ?>
						
	<?php the_content(); ?>
						
</div>
					
<?php endforeach; 
wp_reset_postdata();?>

@JulienMelissas thanks for pointing that out. I’m still quite new to using wordpress and working with responsive layouts, but I will get that fixed right away!

My guess is that you have the front page set to static, which will prevent the <!--more--> tag from working. You need to manually set this option as per the Codex.

1 Like

Fantastic! Thanks for your help! It worked like a charm!