Advertisement
MrPauloeN

WP Dwie Niezależne Pętle - Trzecia Losowo

Mar 29th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <div id="contentleft"> 
  2.  
  3. <?php $my_query = new WP_Query('showposts=1');
  4.    while ($my_query->have_posts()) : $my_query->the_post();
  5.   $do_not_duplicate[] = $post->ID ?>
  6.  
  7. <!-- do stuff -->
  8.  
  9. <?php endwhile; ?>
  10.  
  11. <div id="second-loop">
  12.  
  13.  <?php if (have_posts()) : while (have_posts()) : the_post();
  14.  if (in_array($post->ID, $do_not_duplicate)) continue;
  15.  ?>
  16.  
  17. <!-- do stuff-->
  18.  
  19. <?php endwhile; else: ?>
  20.  
  21. <p><?php _e('Sorry, no posts matched your criteria.'); ?></p><?php endif; ?>
  22.  
  23. </div>
  24.  
  25.  
  26. <div id="third-loop">
  27.  
  28. <h3>Losowe Wideo: </h3>
  29. <?php
  30. $args = array( 'numberposts' => 2, 'orderby' => 'rand' );
  31. $rand_posts = get_posts( $args );
  32. foreach( $rand_posts as $post ) : ?>
  33.     <a href="<?php the_permalink(); ?>"><img src=""/></a>
  34.     <?php echo get_post_meta($post->ID, "wideo", true); ?>
  35. <?php endforeach; ?>
  36.  
  37.  
  38.  
  39.  
  40.  
  41. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement