Advertisement
romimitu

shortcode Teacher

Nov 26th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1.  
  2. /* Register shortcode Teacher ********************************************/
  3.  
  4.  
  5. function section_feed_shortcode( $atts ) {
  6. extract( shortcode_atts( array( 'limit' => 12, 'type' => 'our-teacher', 'category' => '', 'title' => ''), $atts ) );
  7.  
  8. $paged = get_query_var('paged') ? get_query_var('paged') : 1;
  9.  
  10. query_posts( array (
  11. 'posts_per_page' => $limit,
  12. 'post_type' => $type,
  13. 'order' => 'DESC',
  14. 'teacher_cat' => $category,
  15. 'paged' => $paged ) );
  16.  
  17. $list = '<div class="member"><h2>'.$title.'</h2></div>';
  18.  
  19. while ( have_posts() ) { the_post();
  20.  
  21. $list .='<div class="single_team col-md-3">'
  22. .''.get_the_post_thumbnail( $post->ID, 'teacher-thumbnail' ).''
  23. .'<h2>'.get_the_title().'</h2>'
  24. .'<p>'.get_the_content().'</p>'
  25. .'<div class="social_bookmark">'
  26. .'<a href="#">'.get_post_meta( get_the_ID(), 'mobile', true ).'</i></a>'
  27. .'<a href="'.get_post_meta( get_the_ID(), 'facebook_link', true ).'"><i class="fa fa-facebook"></i></a>'
  28. .'<a href="mailto:'.get_post_meta( get_the_ID(), 'email', true ).'"><i class="fa fa-envelope"></i></a>'
  29. .'</div>'
  30. .'</div>';
  31. }
  32.  
  33. return
  34. '<div class="listings clearfix">'
  35. . $list
  36. . '<div class="nav-previous">' . get_next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts' ) ) . '</div>'
  37. . '<div class="nav-next">' . get_previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>' ) ) . '</div>'
  38. . '</div>' .
  39. wp_reset_query();
  40.  
  41. }
  42. add_shortcode( 'our_teacher', 'section_feed_shortcode' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement