Want more features on Pastebin? Sign Up, it's FREE!
Guest

switch-cpt

By: a guest on Mar 8th, 2011  |  syntax: PHP  |  size: 0.69 KB  |  views: 76  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. switch_to_blog(152);
  4.  
  5.  
  6. $args = array (
  7.  
  8. 'post_type' => 'faculty_profile',
  9. 'orderby' => 'meta_value',
  10. 'meta_key' => 'sortby',
  11. 'order' => 'ASC',
  12. 'posts_per_page' => -1,
  13. );
  14.  
  15. query_posts( $args );
  16.  
  17.  
  18. if ( have_posts() ) : while ( have_posts() ) : the_post();
  19.  
  20. echo "<p><strong>";
  21. echo '<a href="' . get_permalink( get_the_ID()  ) . '">';
  22. the_title(); echo "</a></strong><br />";
  23. echo '<em>' . get_post_meta(get_the_ID(), "faculty-title", true) . '</em>';
  24. echo "<br />";
  25. echo nl2br(get_post_meta(get_the_ID(), "degrees", true));
  26. echo "</p>";
  27. endwhile; else:
  28. echo 'No faculty in this department or program.';
  29. endif;
  30.  
  31. //Reset Query
  32. wp_reset_query();
  33.  
  34. restore_current_blog();
clone this paste RAW Paste Data