/ Published in: PHP

$quote -- name of function
post_type=page -- remove to query posts
orderby=rand -- random order
showposts=1 -- limit to 1 post
effect -- displays 1 random custom excerpt outside of the loop
post_type=page -- remove to query posts
orderby=rand -- random order
showposts=1 -- limit to 1 post
effect -- displays 1 random custom excerpt outside of the loop
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $quote = get_posts('post_type=page&showposts=1&meta_key=quote&orderby=rand'); foreach($quote as $post) : setup_postdata($post); ?> <li class="quote"><a href="<?php the_permalink(); ?>" title="Read the <?php the_title(); ?> case study"><?php echo get_post_meta($post->ID, "quote", true); ?></a> <em><?php echo get_post_meta($post->ID, "quote-author", true); ?></em></li> <?php endforeach; ?>
Comments
