dragunoff

wpquestions.com, ID = 2851(2)

Aug 17th, 2011
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.48 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.  
  5. Template Name: Trustees
  6.  
  7. */
  8.  
  9. ?>
  10.  
  11. <?php get_header(); ?>
  12.  
  13. <h2>Directores - USA</h2>
  14.  
  15. <?php // separate loop
  16. $Directores_usa = new WP_Query();
  17. $Directores_usa->query( array(
  18.     'posts_per_page' => -1, // number of posts to retrieve, -1 pulls all posts
  19.     'order' => 'ASC', // ascending order, default ordering by date
  20.     'post_type' => 'Directores', // custom post type slug
  21.     'tax_query' => array(
  22.         array(
  23.             'taxonomy' => 'Location', // taxonomy slug
  24.             'field' => 'slug', // term field to match agains
  25.             'terms' => 'usa' // actual term
  26.             )
  27.         )
  28.     )
  29. );
  30.  
  31. // loop
  32. if ( $Directores_usa->have_posts() ) : ?>
  33.  
  34.     <?php while ( $Directores_usa->have_posts() ) : $Directores_usa->the_post(); ?>
  35.        
  36.     <?php /* To avoid code repetition, let's move the part for displaying the post into another template file
  37.     this will load a file called loop-trustees.php in the theme root; if it doesn't exist loop.php would be loaded instead
  38.     */
  39.     get_template_part( 'loop', 'trustees' ); ?>
  40.        
  41.     <?php endwhile; ?>
  42.    
  43. <?php endif; ?>
  44.  
  45.  
  46. <h2>Directores - Europe</h2>
  47.  
  48. <?php // separate loop
  49. $Directores_europe = new WP_Query();
  50. $Directores_europe->query( array(
  51.     'posts_per_page' => -1, // number of posts to retrieve, -1 pulls all posts
  52.     'order' => 'ASC', // ascending order, default ordering by date
  53.     'post_type' => 'Directores', // custom post type slug
  54.     'tax_query' => array(
  55.         array(
  56.             'taxonomy' => 'Location', // taxonomy slug
  57.             'field' => 'slug', // term field to match agains
  58.             'terms' => 'europe' // actual term
  59.             )
  60.         )
  61.     )
  62. );
  63.  
  64. if ( $Directores_europe->have_posts() ) : ?>
  65.  
  66.     <?php while ( $Directores_europe->have_posts() ) : $Directores_europe->the_post(); ?>
  67.        
  68.     <?php get_template_part( 'loop', 'trustees' ); ?>
  69.        
  70.     <?php endwhile; ?>
  71.    
  72. <?php endif; ?>
  73.  
  74.  
  75. <h2>Staff</h2>
  76.  
  77. <?php // separate loop
  78. $staff = new WP_Query();
  79. $staff->query( array(
  80.     'posts_per_page' => -1, // number of posts to retrieve, -1 pulls all posts
  81.     'order' => 'ASC', // ascending order, default order by date
  82.     'post_type' => 'Staff', // custom post type slug
  83.     'tax_query' => array(
  84.         array(
  85.             'taxonomy' => 'Trustee', // taxonomy slug
  86.             'field' => 'slug', // term field to match agains
  87.             'terms' => 'yes' // actual term
  88.             )
  89.         )
  90.     )
  91. );
  92.  
  93. if ( $staff->have_posts() ) : ?>
  94.  
  95.     <?php while ( $staff->have_posts() ) : $staff->the_post(); ?>
  96.        
  97.     <?php get_template_part( 'loop', 'trustees' ); ?>
  98.        
  99.     <?php endwhile; ?>
  100.    
  101. <?php endif; ?>
  102.  
  103. <?php get_sidebar(); ?>
  104.  
  105. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment