Same content for different posts in single.php
-
Hi there, I got a bit of an issue with all my posts displaying the same content after adding a small loop to the sidebar.
Here’s my single.php code:
<?php
// Exit if accessed directly
if ( !defined('ABSPATH')) exit;get_header(); ?>
<div class="container">
<!-- SIDEBAR LEFT -->
<div class="red left">Latest<?php $posts = get_posts('numberposts=3&offset=0');
foreach ($posts as $post) : start_wp(); ?><div style="width:190px; height: 170px;margin-bottom:7px;"><div>"><?php if ( has_post_thumbnail() ) { the_post_thumbnail( '190x110' ); } ?><div><div><span class="title"><b>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="bookmark" ><?php the_title(); ?></b></span></div></div></div>
</div><?php endforeach; ?>
</div></div>
<!-- SIDEBAR LEFT END -->
<div class="blue2">
<div class="box"><p class="tit" style="margin-left:0px;margin-top:0px;margin-bottom:10px;"><?php the_title(); ?></p>
<?php the_content(); ?></div></div></div>
<?php get_footer(); ?>
What do I do wrong?
- The topic ‘Same content for different posts in single.php’ is closed to new replies.