Advertisement
Guest User

Untitled

a guest
May 28th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. $args = array(
  2. 'posts_per_page' => 1,
  3. 'orderby' => 'rand',
  4. 'post_type' => 'product' );
  5.  
  6. $random_products = get_posts( $args );
  7.  
  8. foreach ( $random_products as $post ) : setup_postdata( $post ); ?>
  9. <li>
  10. <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
  11. </li>
  12. <?php endforeach;
  13. wp_reset_postdata();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement