Advertisement
webrur

Class 17

Apr 25th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
  2.  
  3. function factorian_service_box_shortcode($atts, $content = null){
  4. extract( shortcode_atts( array(
  5. 'title' => '',
  6. 'desc' => '',
  7. 'link_type' => 1,
  8. 'select_page' => '',
  9. 'link_address' => '',
  10. 'icon_type' => '',
  11. 'upload_icon' => '',
  12. 'pick_icon' => '',
  13. 'upload_background' => '',
  14. 'link_text' => 'See more',
  15. ), $atts) );
  16.  
  17. if($link_type == 1) {
  18. $link_source = get_page_link($select_page);
  19. } else {
  20. $link_source = $link_address;
  21. }
  22.  
  23. $service_box_bg = wp_get_attachment_image_src($upload_background, 'medium');
  24.  
  25. $factorian_service_box_markup ='
  26. <div class="factorian-service-box">
  27. <div class="factorian-service-box-icon-table" style="background-image: url('.$service_box_bg[0].');">
  28. <div class="factorian-service-box-icon-tablecell">';
  29.  
  30. if($icon_type == 1) {
  31. $icon_source = wp_get_attachment_image_src($upload_icon, 'thumbnail');
  32. $factorian_service_box_markup .='<img src="'.$icon_source[0].'" />';
  33. } else {
  34. $factorian_service_box_markup .='<i class="'.$pick_icon.'"></i>';
  35. }
  36.  
  37. $factorian_service_box_markup .='
  38. </div>
  39. </div>
  40.  
  41. <div class="factorian-service-box-content">
  42. <h3 class="factorain-service-box-title">'.$title.'</h3>
  43. '.wpautop($desc).'
  44. <a class="factorain-service-box-btn" href="'.$link_source.'">'.$link_text.'</a>
  45. </div>
  46. </div>
  47. ';
  48.  
  49.  
  50.  
  51. return $factorian_service_box_markup;
  52.  
  53. }
  54. add_shortcode('factorian_service_box', 'factorian_service_box_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement