Guest User

Untitled

a guest
May 27th, 2016
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.24 KB | None | 0 0
  1. <?php
  2. /**
  3. * Template Name: Event List.
  4. * The template for displaying all pages.
  5. *
  6. * This is the template that displays all pages by default.
  7. * Please note that this is the WordPress construct of pages
  8. * and that other 'pages' on your WordPress site will use a
  9. * different template.
  10. *
  11. * @package joerghalubek
  12. */
  13.  
  14. get_header('page'); ?>
  15. <div id="primary" class="padding20px content-area">
  16. <main id="main" class="site-main" role="main">
  17. <div class="container">
  18. <div class="row">
  19. <div class="col-sm-12">
  20. <h2 class="section-headline-left">Vergangene Veranstaltungen</h2>
  21. </div>
  22. </div>
  23. <div class="row">
  24. <div class="col-sm-12 section-content">
  25. <div class="container overwrite-bs">
  26.  
  27. <?php
  28.  
  29. $yearcurrent = date('Y');
  30. $monthcurr = date('n');
  31.  
  32. for ($monthcurrent = $monthcurr ; $monthcurrent >= 1; $monthcurrent--) {
  33.  
  34. ?><h3 class="title--month">
  35.  
  36. if ( $monthcurrent == "12" ) { echo "Dezember"; }
  37. elseif ( $monthcurrent == "11" ) { echo "November"; }
  38. elseif ( $monthcurrent == "10" ) { echo "Oktober"; }
  39. elseif ( $monthcurrent == "9" ) { echo "September"; }
  40. elseif ( $monthcurrent == "8" ) { echo "August"; }
  41. elseif ( $monthcurrent == "7" ) { echo "Juli"; }
  42. elseif ( $monthcurrent == "6" ) { echo "Juni"; }
  43. elseif ( $monthcurrent == "5" ) { echo "Mai"; }
  44. elseif ( $monthcurrent == "4" ) { echo "April"; }
  45. elseif ( $monthcurrent == "3" ) { echo "März"; }
  46. elseif ( $monthcurrent == "2" ) { echo "Februar"; }
  47. elseif ( $monthcurrent == "1" ) { echo "Januar"; }
  48.  
  49. } ?></h3><?
  50.  
  51. for ($year = $yearcurrent-1; $year >= 2009; $year--) {
  52.  
  53. $monthminus = 13;
  54.  
  55. for ($month = 12; $month >= 1; $month-- ) {
  56.  
  57. if ( $monthminus > 1 ) { $monthminus = $monthminus - 1; } else { $monthminus = 1; }
  58.  
  59. global $post;
  60.  
  61. echo $year;
  62. echo "-";
  63.  
  64. if ( $month == "12" ) { echo "Dezember"; }
  65. elseif ( $month == "11" ) { echo "November"; }
  66. elseif ( $month == "10" ) { echo "Oktober"; }
  67. elseif ( $month == "9" ) { echo "September"; }
  68. elseif ( $month == "8" ) { echo "August"; }
  69. elseif ( $month == "7" ) { echo "Juli"; }
  70. elseif ( $month == "6" ) { echo "Juni"; }
  71. elseif ( $month == "5" ) { echo "Mai"; }
  72. elseif ( $month == "4" ) { echo "April"; }
  73. elseif ( $month == "3" ) { echo "März"; }
  74. elseif ( $month == "2" ) { echo "Februar"; }
  75. elseif ( $month == "1" ) { echo "Januar"; }
  76.  
  77.  
  78. $all_events = tribe_get_events(array(
  79. 'start_date' => $year.'-'.$month. '-01',
  80. 'end_date' => $year.'-'.$monthminus. '-01',
  81. 'posts_per_page'=> -1,
  82. 'orderby' => date,
  83. 'order' => DESC,
  84. 'eventDisplay' => PAST
  85. ));
  86.  
  87.  
  88. foreach($all_events as $post) {
  89. setup_postdata($post); ?>
  90.  
  91. <div class="row event--single">
  92. <div class="col-xs-12 col-sm-3">
  93. <a href="<?php echo tribe_get_event_link(); ?>">
  94. <? echo tribe_get_start_date($post->ID, false, 'j. F Y'); ?>
  95. </a>
  96. </div>
  97. <div class="col-xs-12 col-sm-4">
  98. <a href="<?php echo tribe_get_event_link(); ?>">
  99. <?php echo sp_get_city(); ?> | <? echo sp_get_venue(); ?><br />
  100. </a>
  101. </div>
  102. <div class="col-xs-12 col-sm-5">
  103. <a href="<?php echo tribe_get_event_link(); ?>">
  104. <?php the_title(); ?>
  105. </a>
  106. </div>
  107. </div>
  108.  
  109. <?php }
  110. wp_reset_query();
  111. wp_reset_postdata();
  112. }
  113. }
  114. ?>
  115. </div>
  116. </div>
  117. </div>
  118. </main><!-- #main -->
  119. </div><!-- #primary -->
  120. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment