Get Post – strange behaviour
-
Hi, I use the code below to display a random page from a certain post parent. The excerpt seems to work the first time the page is loaded then does not refresh / update again!.
Can anyone spot the problem? Thanks for your help.
<div class="box"> <div class="service-box"> <h3>Services</h3> <?php $rand_posts = get_posts('posts_per_page=1&post_type=page&post_parent=35&orderby=rand'); foreach( $rand_posts as $post ) : ?> <div class="box-inner"> <span><?php the_title(); ?></span> <?php the_excerpt(); ?> </div> <a href="<?php the_permalink(); ?>" class="button">Find out more</a> <?php endforeach; ?> </div> <?php wp_reset_query(); ?> </div><!-- end box -->
- The topic ‘Get Post – strange behaviour’ is closed to new replies.