Problems with single post
-
Hi!
I’m working on a customized theme for a magazine. All works fine but while working on single post template I got some serious problems. Here is a list of problems and additional details about them.
1- As you can see it here, a list of latest news on the website are displayed in a sidebar next to post content. I’m using default loop to get the content of single post. To get a list of latest posts with thumbnails, I included the following code in the single.php file. Note, this loop is within the default loop of single post.
<?php $small_thumb_h_entry = 96; $small_thumb_w_entry = 196; $ppp_entry = 5; $cat_news_entry = array( 21,17,26,6); // Category IDs $args_entry = array( 'category__in' => $cat_news_entry, 'posts_per_page' => $ppp_entry ); $my_query_entry = new WP_Query($args_entry); if($my_query_entry->have_posts()) : ?> <div id="news-block-entry"> <?php while ($my_query_entry->have_posts()) : $my_query_entry->the_post(); ?> <?php $small_placeholder_entry = '<a href="'.get_permalink().'" title="'. get_the_title() .'"><img width="'.$small_thumb_w_entry.'" height="'.$small_thumb_h_entry.'" src="' . get_bloginfo('template_url') . '/images/empty_small_entry.jpg" alt="' . get_the_title() .'" /></a>'; ?> <div class="item"> <?php if ( woo_image('return=true') ) { woo_image('key=image&width='. $small_thumb_w_entry .'&height=' . $small_thumb_h_entry); } ?> <span class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></span> </div><!-- /.item --> <?php endwhile; ?> <div class="fix"></div> </div><!-- /#news-block-entry --> <?php endif; ?>
However as you can see in the screenshot, the post that is displayed on the page appears in the latest news list. In other words, the post is duplicated. So the question is that “How could I avoid?”
2- This one is about comments. For a reason I’ve not figured out yet, since I added this latest news sidebar to my code, the comments which belong to the latest post listed in latest news column are displayed on every single post. Any idea how to resolve that?
Thanks for your help in advance.
Cheers!
- The topic ‘Problems with single post’ is closed to new replies.