how to display a random page in a static front page
for the above mentioned problem I used a solution from another closed topic :
by Triple P
I have no doubt about solution but in my site/template if I place the following code
<?php $args = array( 'post_type' => 'page', 'numberposts' => 1, 'orderby' => 'rand' ); $rand_posts = get_posts( $args ); foreach( $rand_posts as $post ) : ?> <a>"><?php the_title(); ?> <?php the_content(); ?> <?php endforeach; ?>
inside my index page it duplicates the content of all pages.
How can I fix this problem???
Thank you for your kind cooperation
- The topic ‘how to display a random page in a static front page’ is closed to new replies.