Guest User

Untitled

a guest
Mar 23rd, 2015
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 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 = true;
  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. $td_module_api = td_api_module::get_by_id($td_module_class);
  24. if ($td_module_api['uses_columns'] === false) {
  25. $td_template_layout->disable_output();
  26. }
  27.  
  28.  
  29. if (have_posts()) {
  30. $adcounter = 0;
  31. while ( have_posts() ) : the_post();
  32. echo $td_template_layout->layout_open_element();
  33.  
  34. if (class_exists($td_module_class)) {
  35. $td_mod = new $td_module_class($post);
  36. echo $td_mod->render();
  37. } else {
  38. td_util::error(__FILE__, 'Missing module: ' . $td_module_class);
  39. }
  40.  
  41. echo $td_template_layout->layout_close_element();
  42. $td_template_layout->layout_next();
  43.  
  44. $adcounter++;
  45. if ($adcounter == 2 or $adcounter == 4 ) {
  46. echo td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'custom_ad_1'));
  47. }
  48.  
  49. endwhile; //end loop
  50. echo $td_template_layout->close_all_tags();
  51.  
  52.  
  53. } else {
  54. /**
  55. * no posts to display. This function generates the __td('No posts to display').
  56. * the text can be overwritten by the themplate using the global @see td_global::$custom_no_posts_message
  57. */
  58.  
  59. echo td_page_generator::no_posts();
  60. }
Advertisement
Add Comment
Please, Sign In to add comment