Using the_excerpt() before the main loop in 2.1
-
In 2.0, I could take the post object returned by get_results() and call the_excerpt() on that object before the main loop started.
After upgraded to 2.1, this no longer seems to work (doesn’t return any text). However, calls to the_permalink(), the_title(), and the_time() still work in this scenario. How can I get the_excerpt() to work before the main loop?
An example of what I’m trying to do is:
<?php $random_posts = $wpdb->get_results($sql); foreach ($random_posts as $post) { ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title();?></a><br/> Posted on <?php the_time('j F Y', display); ?> <?php the_excerpt(); ?> <?php } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Using the_excerpt() before the main loop in 2.1’ is closed to new replies.