Hi, I want to show a random post in my header, and a list my recent posts + my last post on my index page. The problem is, they don't work well together and when I click on a link, I get the wrong post...
Here is my code for the random post:
<?php
query_posts(array('orderby' => 'rand', 'posts_per_page' => 1));
if (have_posts()) :
while (have_posts()) : the_post(); ?>
<?php the_excerpt(); ?>
<?php endwhile;
endif; ?>
Here is my code for the (3) recent posts:
<?php query_posts('posts_per_page=3&offset=1'); ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
<?php endwhile; ?>
And here my loop on the main page:
<?php query_posts('posts_per_page=1'); ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
<?php endwhile; ?>
I tried everything I could, checked everything but I guess I must have missed something because it doesn't work. Thank you very much for your help, I'm stucked!