Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. <?php while ( have_posts() ) : the_post(); ?>
  2. <?php get_template_part( 'content-parts/content', 'team' ); ?>
  3. <?php endwhile; ?>
  4.  
  5. <?php
  6. $terms = get_terms( 'competition', array(
  7. 'orderby' => 'count',
  8. 'hide_empty' => true,
  9. ) );
  10. ?>
  11. <?php
  12. foreach( $terms as $term ) {?>
  13. <section class="achievement-section clearfix">
  14. <?php $counter = 0; ?>
  15. <div class=" league-and-season clearfix">
  16. <div class="honour-league-name"> <?php echo $term->name; ?> </div>
  17. <?php
  18. $team = get_post_meta( get_the_ID(), 'football_team_team_name', true );
  19. $args = array(
  20. 'post_type' => 'football_league',
  21. 'tax_query' => array(
  22. array(
  23. 'taxonomy' => 'competition',
  24. 'field' => 'slug',
  25. 'terms' => $term
  26. ),
  27. ),
  28. 'meta_query' => array(
  29. array(
  30. 'key' => 'football_league_team_name',
  31. 'value' => $team,
  32. 'compare' => '='
  33. ),
  34. ),
  35. );
  36.  
  37. $fixture_query = null;
  38. $fixture_query = new WP_Query($args); ?>
  39. <div class="honour-season-name">
  40. <ul >
  41. <?php while ( $fixture_query->have_posts() ) : $fixture_query->the_post(); ?>
  42. <?php
  43. $champion_team = get_post_meta( get_the_ID(), 'football_league_team_name', true );
  44. $terms_competition = get_the_terms( get_the_ID(), 'competition' );
  45. $terms_season = get_the_terms( $post->ID , 'season' ); ?>
  46. <?php
  47. foreach ($terms_season as $object) {?>
  48. <li> <?php echo $object->name; ?></li>
  49. <?php }
  50. ?>
  51. <?php $counter++; ?>
  52. <?php endwhile; ?>
  53. <?php wp_reset_postdata(); ?>
  54. </ul>
  55. </div>
  56. </div>
  57. <div class="achievement-times"><span><?php echo $counter; ?> </span></div>
  58. </section>
  59. <?php }
  60. ?>
  61.  
  62. <?php
  63. $terms = wp_get_post_terms($post->ID, 'competition'); ?>
  64. <?php
  65. $count = count($terms);
  66. if ( $count > 0 ) {
  67. foreach( $terms as $term ) {?>
  68. <section class="achievement-section clearfix">
  69. <?php $counter = 0; ?>
  70. <div class=" league-and-season clearfix">
  71. <div class="honour-league-name"> <?php echo $term->name; ?> </div>
  72. <?php
  73. $team = get_post_meta( get_the_ID(), 'football_team_team_name', true );
  74. $args = array(
  75. 'post_type' => 'football_league',
  76. 'tax_query' => array(
  77. array(
  78. 'taxonomy' => 'competition',
  79. 'field' => 'slug',
  80. 'terms' => $term
  81. ),
  82. ),
  83. 'meta_query' => array(
  84. array(
  85. 'key' => 'football_league_team_name',
  86. 'value' => $team,
  87. 'compare' => '='
  88. ),
  89. ),
  90. );
  91.  
  92. $fixture_query = null;
  93. $fixture_query = new WP_Query($args); ?>
  94. <div class="honour-season-name">
  95. <ul >
  96. <?php while ( $fixture_query->have_posts() ) : $fixture_query->the_post(); ?>
  97. <?php
  98. $champion_team = get_post_meta( get_the_ID(), 'football_league_team_name', true );
  99. $terms_competition = get_the_terms( get_the_ID(), 'competition' );
  100. $terms_season = get_the_terms( $post->ID , 'season' ); ?>
  101. <?php
  102. foreach ($terms_season as $object) {?>
  103. <li> <?php echo $object->name; ?></li>
  104. <?php }
  105. ?>
  106. <?php $counter++; ?>
  107. <?php endwhile; ?>
  108. <?php wp_reset_postdata(); ?>
  109. </ul>
  110. </div>
  111. </div>
  112. <div class="achievement-times"><span><?php echo $counter; ?> </span></div>
  113. </section>
  114. <?php }
  115. }
  116. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement