• I currently have this code on my template.

    <?php
    $args = array( 'numberposts' => 5, 'orderby' => 'rand', 'post_status' => 'publish', 'offset' => 1);
    $rand_posts = get_posts( $args );
    foreach( $rand_posts as $post ) : ?>
    <li><h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2><p><?php the_excerpt(); ?>
    </p></li>
    <?php endforeach; ?>
    </ul>

    The nature of the code is to generate a Random list of blog post. The problem is, the code starts ruining my comments section by displaying the wrong list of comments to unrelated blog post?

    The common sense to do is remove to code in my template. My question is any ideas on how to fix the code above so i can still use it?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Random Post ruining my Comments section’ is closed to new replies.