Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. function sc_loop_highlights_lehrer() {
  2. $args = array( 'post_type' => 'lehrer', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => array('publish'),
  3. 'tax_query' => array(
  4. array(
  5. 'taxonomy' => 'highlights',
  6. 'field' => 'slug',
  7. 'terms' => array('ja')
  8. )
  9. )
  10. );
  11.  
  12. $string = '';
  13. $count = 0;
  14.  
  15. $query = new WP_Query( $args );
  16.  
  17. if( $query->have_posts() ){
  18.  
  19. $string .= '<div class="list-posts">';
  20. $string .= '<div class="lehrer-referenten-highlights wrap-cpt cf">';
  21. $string .= '<h2 class="heading-title">Highlights 2017</h2>';
  22.  
  23. while( $query->have_posts() ){
  24. $query->the_post();
  25. $count++;
  26. global $post;
  27.  
  28. $string .= '<div class="cpt nth-'. ($xyz++%2) .' ">';
  29. /* $string .= '<a class="block scroll " title="' . get_the_title() . '" href="' . esc_url( get_permalink(3970) ) .'#lehrer-referenten-id-' . get_the_ID() . '">'; */
  30. $string .= '<a class="block" title="' . get_the_title() . '" href="' . esc_url( get_permalink(3970) ) .'#' . $post->post_name . '">';
  31.  
  32. $string .= '<div class="outer cf">';
  33. if( has_post_thumbnail() ) {
  34. $string .= get_the_post_thumbnail( $post_id, 'partnerlogo' );
  35. }
  36. $string .= '<div class="inner">';
  37. $string .= '<h4>';
  38. $string .= get_the_title();
  39. $string .= '</h4>';
  40. $string .= '</div>';
  41.  
  42. $string .= '</div>';
  43.  
  44. $string .= '</a>';
  45. $string .= '</div>';
  46.  
  47. }
  48. $string .= '</div></div>';
  49. }
  50. wp_reset_postdata();
  51. return $string;
  52. }
  53. add_shortcode( 'highlights_lehrer', 'sc_loop_highlights_lehrer' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement