Post your single.php here.
Let me take a look at it.
Are you using a widget on your sidebar for the other news?
Thread Starter
cjbee
(@cjbee)
Nope — not using any sidebar or widget on this page. The “other news” is just listed in a div that I added within the template:
<?php get_header(); ?>
<div id="page">
<div id="page-inner" class="clearfix">
<div id="othernews">
<div class="box">
<h3>Other News</h3>
<ul><?php get_archives('postbypost', '6', 'html', '', '', FALSE); ?></ul>
</div>
</div>
<div id="content">
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" class="post-content clearfix">
<h3 class="entry-title"><?php the_title(); ?></h3>
<?php include (TEMPLATEPATH . '/includes/postmeta.php'); ?>
<?php if (has_post_thumbnail()) {
$thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumbnail_name');
?><a>" rel="shadowbox"><img class="postimg" src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo $thumb[0]; ?>&zc=1&w=625&h=400&q=100&a=c" alt="<?php
the_title(); ?>" /></a>
<?php } ?>
<div class="entry clearfix">
<?php the_content(); ?>
<?php wp_reset_query(); ?>
<!-- <?php trackback_rdf(); ?> -->
<p><a href="history.go(-1)"><span class="arrow_back">Back</span></a></p><div class="divider"></div>
</div>
<div id="comments">
<?php comments_template(); ?>
</div>
</div>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
</div>
<?php get_footer(); ?>
Probably best If I can actually see your website.
And also the codes on your OTHER NEWS.
Thread Starter
cjbee
(@cjbee)
Here’s a link to a single post:
http://www.thirtylivegroup.com/2011/02/30live-group-feature-band-aardvark-robinson/
*Note: The “outernews” div referenced in the code I posted above was changed for clarity…on the actual site, that div is actually called “sidebar”.
Let’s start on your sidebar.
You can remove that by adding this code to your LOOP.
if( $post->ID == '112' ) continue;
Replace the 112 with the POST ID of that post.
Example:
<?php while (have_posts()) : the_post(); if( $post->ID == '112' ) continue; ?>
Try that.
Thread Starter
cjbee
(@cjbee)
Thanks, but it didn’t seem to do anything. 🙁
Let me see your sidebar codes.
Thread Starter
cjbee
(@cjbee)
That sidebar isn’t actually a sidebar…as in, not dynamic. I basically hard-coded the “other news” box within the XHTML, if that makes any difference.
The code I’m using is essentially what I listed above:
<div id="othernews">
<div class="box">
<h3>Other News</h3>
<ul><?php get_archives('postbypost', '6', 'html', '', '', FALSE); ?></ul>
</div>
</div>
That’s all I’m using to display that list of other posts.
<div id="othernews">
<div class="box">
<h3>Other News</h3>
<ul>
<?php query_posts('posts_per_page=6'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == '117' ) continue; ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?><?php endif; ?>
<?php wp_reset_query(); ?>
</ul>
</div>
</div>
Try this code.
And please edit the 117 for the POST ID of that POST.
Thread Starter
cjbee
(@cjbee)
Yes! That works brilliantly. Thanks so much. But…
What would I have to add if I want the POST ID in that code to reflect the POST ID of whatever post is currently being viewed?
Hang-on Let me test it on my server first.
Thread Starter
cjbee
(@cjbee)
No problem.
Thanks again for all your help.
<div id="othernews">
<div class="box">
<h3>Other News</h3>
<ul>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $filteredid = the_ID(); ?>
<?php endwhile; ?><?php endif; ?>
<?php query_posts('posts_per_page=6'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == '$filteredid' ) continue; ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?><?php endif; ?>
<?php wp_reset_query(); ?>
</ul>
</div>
</div>
Try this.. I hope this works.
Thread Starter
cjbee
(@cjbee)
All it seems to be doing is spitting out the ID of the post at the top of the list:
http://www.thirtylivegroup.com/images/screenshot2.jpg
I see where you were going with it though…
Ok.. Try this..
<div id="othernews">
<div class="box">
<h3>Other News</h3>
<ul>
<?php if (have_posts()) : while (have_posts()) : the_post(); $nodup = $post->ID; ?>
<?php endwhile; ?><?php endif; ?>
<?php query_posts('posts_per_page=6'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == $nodup ) continue; ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?><?php endif; ?>
<?php wp_reset_query(); ?>
</ul>
</div>
</div>