• Hi I am working on putting a custom random post section at the bottom of the content section but above the comments. The issue that I am running into is the comments from the page that is the last link under the random post section. Is there a way to fix this so the comments are from the article above? Here is what I have.

    <?php $posts = get_posts('orderby=rand&numberposts=4'); foreach($posts as $post) { ?>
            	<div style="width:180px; float:left;">
               		<div class="clearfix" style="margin-right:25px;">
                    	<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?></a>
                    </div>
                    <div style="font-size:12px; line-height:14px; height:43px; width:140px; margin-right:25px; margin-bottom:10px;">
                    	<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
                    </div>
               	</div>
         	<?php } ?>

    Also is it possible to create this so that the current post doesn’t show up in the random post?

    Thanks
    Brian

    [No bumping. If it’s that urgent, consider hiring someone.]

The topic ‘Custom Random Post on single.php’ is closed to new replies.