Guest User

Untitled

a guest
Jan 13th, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. <?php
  2. /**
  3. * If you are looking for the loop that's handling the single post page (single.php), check out loop-single.php
  4. **/
  5.  
  6.  
  7. // $global_flag_to_hide_no_post_to_display - comes from page-category-big-grid.php and is a flag to hide the 'No posts to display' message if on category page there are between 1 and 5 posts
  8. global $loop_module_id, $loop_sidebar_position, $global_flag_to_hide_no_post_to_display;
  9.  
  10. ///if we are in wordpress loop; used by quotes in blocks to check if the blocks are displayed in blocks or in loop
  11. td_global::$is_wordpress_loop = 'wordpress_loop';
  12.  
  13. $td_template_layout = new td_template_layout($loop_sidebar_position);
  14.  
  15. if (empty($loop_module_id)) { //not sure if we need a default here
  16. $loop_module_id = 1;
  17. }
  18.  
  19. $td_module_class = td_util::get_module_class_from_loop_id($loop_module_id);
  20.  
  21.  
  22. //disable the grid for some of the modules
  23. if (td_global::$modules_list[$td_module_class]['uses_columns'] === false) {
  24. $td_template_layout->disable_output();
  25. }
  26.  
  27.  
  28. if (have_posts()) {
  29. $adcounter = 0;
  30. while ( have_posts() ) : the_post();
  31. echo $td_template_layout->layout_open_element();
  32.  
  33. if (class_exists($td_module_class)) {
  34. $td_mod = new $td_module_class($post);
  35. echo $td_mod->render();
  36. } else {
  37. td_util::error(__FILE__, 'Missing module: ' . $td_module_class);
  38. }
  39.  
  40. echo $td_template_layout->layout_close_element();
  41. $td_template_layout->layout_next();
  42. $adcounter++;
  43. if ($adcounter == 2 or $adcounter == 4 ) {
  44. echo td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'custom_ad_1'));
  45. }
  46. endwhile; //end loop
  47. echo $td_template_layout->close_all_tags();
  48.  
  49.  
  50. } else {
  51. /**
  52. * no posts to display. This function generates the __td('No posts to display').
  53. * the text can be overwritten by the themplate using the global @see td_global::$custom_no_posts_message
  54. */
  55.  
  56. echo td_page_generator::no_posts();
  57. }
Advertisement
Add Comment
Please, Sign In to add comment