• Hello all,

    I have a problem. Visit my site Gadgetsteria. Now click on one of the pages at the top and notice how in the side bar it repeats what is posted on that page….why? I have the side bar coded so that the 3 tabs (Featured, reviews, and how-to’s) display 5 random posts from each respective category. It works fine on the homepage and in individual posts but not on different pages. Here is the code for the sidebar.

    *edit*
    ok now I just realized it does it on the home page too. It was workign on the home page earlier.

    <div id="sidebar">
    <?php include (TEMPLATEPATH . '/ads.php'); ?>
    
    <div class="box">
    	<h2>RSS Subscription</h2>
    	<div class="subscribe">
    
    	<div class="rssfeedlinks"><a href="<?php bloginfo('rss2_url'); ?>">Posts RSS</a><a href="<?php bloginfo('comments_rss2_url'); ?>">Comments RSS</a><div class="clear"></div></div>
    
    </div>
    
    <ul id="tabs" class="tabs">
    <li><a href="#" rel="tab1" class="selected">Featured Articles</a></li>
    <li><a href="#" rel="tab2">Reviews</a></li>
    <li><a href="#" rel="tab3">How-To's</a></li>
    <li><a href="#" rel="tab4">Tags</a></li>
    </ul>
    
    <div id="tab1" class="tabcontent">
    <ul>
     <?php $rand_posts = get_posts('cat=538&showposts=5&orderby=rand'); foreach( $rand_posts as $post ) : ?>
       <li><a href="<?php the_permalink(); ?>"; ?title="<?php the_excerpt(); ?>"><?php the_title(); ?></a><img class="alignleft" src="<?php echo get_post_meta($post->ID, 'Image', true); ?>" width="65" height="65" align="left" vspace="30" alt="Icon for Post #<?php the_ID(); ?>" /><?php the_excerpt(); ?>
    </a> <?php endforeach; ?>
    <break clear="all">
    <span><?php comments_popup_link('0 Comments', '1 Comment', '% Comments'); ?> Since <?php the_time('l, F j, Y, G:i'); ?></span>
    
    <break clear="all">
     </li></ul>
    </div>
    
    <div id="tab2" class="tabcontent">
    <ul>
     <?php $rand_posts = get_posts('cat=614&showposts=5&orderby=rand'); foreach( $rand_posts as $post ) : ?>
       <li><a href="<?php the_permalink(); ?>"; ?title="<?php the_excerpt(); ?>"><?php the_title(); ?></a><img class="alignleft" src="<?php echo get_post_meta($post->ID, 'Image', true); ?>" width="65" height="65" align="left" vspace="30" alt="Icon for Post #<?php the_ID(); ?>" /><?php the_excerpt(); ?>
    </a> <?php endforeach; ?>
    <break clear="all">
    <span><?php comments_popup_link('0 Comments', '1 Comment', '% Comments'); ?> Since <?php the_time('l, F j, Y, G:i'); ?></span>
    <break clear="all">
     </li></ul>
    </div>
    
    <div id="tab3" class="tabcontent">
    <ul>
     <?php $rand_posts = get_posts('cat=6&showposts=5&orderby=rand'); foreach( $rand_posts as $post ) : ?>
       <li><a href="<?php the_permalink(); ?>"; ?title="<?php the_excerpt(); ?>"><?php the_title(); ?></a><img class="alignleft" src="<?php echo get_post_meta($post->ID, 'Image', true); ?>" width="65" height="65" align="left" vspace="30" alt="Icon for Post #<?php the_ID(); ?>" /><?php the_excerpt(); ?>
    </a> <?php endforeach; ?>
    <break clear="all">
    <span><?php comments_popup_link('0 Comments', '1 Comment', '% Comments'); ?> Since <?php the_time('l, F j, Y, G:i'); ?></span>
    <break clear="all">
     </li></ul>
    </div>
    
    <div id="tab4" class="tabcontent">
    <?php wp_tag_cloud('smallest=8&largest=14&number=30'); ?>
    </div>
    
    <script type="text/javascript">
    var countries=new ddtabcontent("tabs")
    countries.setpersist(false)
    countries.setselectedClassTarget("link")
    countries.init()
    </script>
    
    <div class="clear"></div>
    
    <?php include (TEMPLATEPATH . "/sidebar1.php"); ?>
    <?php include (TEMPLATEPATH . "/sidebar2.php"); ?>
    <div class="clear"></div>
    
    </div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Random Posts code displaying multiple excerpts on pages other than home page’ is closed to new replies.