Guest User

Untitled

a guest
Apr 26th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. <div class="container">
  2. <div class="row">
  3. <ul class="collapsible" data-collapsible="accordion">
  4.  
  5. <?php
  6. $args = array(
  7. 'post_type' => array( 'university' ),
  8. 'post_status' => array( 'publish' ),
  9. 'taxonomy' => 'country',
  10. 'posts_per_page' => '1',
  11.  
  12. );
  13. // The Query
  14. $query = new WP_Query( $args );
  15.  
  16. $categories = get_categories($args);
  17.  
  18. // The Loop
  19. if ( $query->have_posts() ) {
  20. while ( $query->have_posts() ) {
  21. $query->the_post();
  22. // do something
  23.  
  24. foreach ($categories as $category){ ?>
  25.  
  26. <li class="home-list hoverable col m6 z-depth-1">
  27. <div class="collapsible-header"><h5><i class="material-icons teal-text">add_circle_outline</i>
  28. <?php
  29. //echo var_dump($category);
  30. $cat_name = $category->name;
  31. $cat_count = $category->count;
  32.  
  33. echo 'Medical Universities in '.$cat_name;
  34. //echo $category->count;
  35. echo '</h5></div>';?>
  36.  
  37. <div class="collapsible-body"><span>
  38. <?php
  39. echo $cat_count;
  40. $custom_terms = get_terms('country');
  41. //echo var_dump($custom_terms);
  42.  
  43. ?>
  44.  
  45. </span></div>
  46. <?php
  47.  
  48.  
  49. }
  50. ?>
  51. </li>
  52.  
  53.  
  54. <?php }
  55. } else {
  56. // no posts found
  57. }
  58.  
  59. // Restore original Post Data
  60. wp_reset_postdata();
  61. ?>
Add Comment
Please, Sign In to add comment