Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. function my_custom_loop_2 ($category, $tag, $offset) {
  2. $args=array(
  3. // showposts has been replaced, use 'posts_per_page' instead
  4. // 'showposts' =>1,
  5. 'posts_per_page' => 3,
  6. // this has been replaced, use 'ignore_sticky_posts'
  7. // 'caller_get_posts' => 1,
  8. 'ignore_sticky_posts' => true,
  9. );
  10.  
  11. if ($category) {
  12. $args['cat'] = $category;
  13. }
  14.  
  15. if ($tag) {
  16. $args['tag'] = $tag;
  17. }
  18.  
  19. if ($offset) {
  20. $args['offset'] = $offset;
  21. }
  22.  
  23. $my_query = new WP_Query($args);
  24. // ... rest of function to output loop
  25.  
  26. if( $my_query->have_posts() ) {
  27. while ($my_query->have_posts()) : $my_query->the_post(); ?>
  28. <div class="three-titles">
  29. <a href="<?php the_permalink() ?>" ><?php the_title(); ?></a></br>
  30. </div>
  31. <?php
  32. endwhile;
  33. } //if ($my_query)
  34.  
  35. wp_reset_query(); // Restore global post data stomped by the_post().
  36. };
  37.  
  38. <?php my_custom_loop_3(13, NULL, 1); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement