Advertisement
Guest User

service-shortcode.php

a guest
Apr 29th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.43 KB | None | 0 0
  1. <?php
  2.  
  3. function seo_service_box_shortcode($atts, $content = null){
  4.  
  5. extract( shortcode_atts(array(
  6.         'title' => '',
  7.         'desc' => '',
  8.         'type' => 1,
  9.         'link_to_page' => '',
  10.         'external_link' => '',
  11.         'link_text' => 'See more',
  12.         'icon_type' => 1,
  13.         'upload_icon' => '',
  14.         'choose_icon' => '',
  15.         'box_background' => '',
  16.     ), $atts) );   
  17. if($type == 1){
  18.     $link_source = get_page_link($link_to_page);
  19. }else{
  20.     $link_source = $external_link;
  21. }
  22.    
  23.     $box_background = wp_get_attachment_image_src($box_background, 'medium');
  24.    
  25.    
  26. $seo_service_box_markup = '
  27. <div class="seo-service-box">
  28. <div style="background-image:url('.$box_background[0].')" class="seo-service-icon">
  29.  <div class="seo-service-table">
  30.   <div class="seo-service-tablecell">';
  31.    
  32.   if($icon_type == 1){
  33.     $service_icon_array = wp_get_attachment_image_src($upload_icon, 'thumbnail');
  34.     $seo_service_box_markup .= '<img src="'.$service_icon_array[0].'" alt=""/>';  
  35.   }else{
  36.     $seo_service_box_markup .= '<i class="'.$choose_icon.'"></i>';  
  37.   }
  38.      
  39. $seo_service_box_markup .= '
  40.  
  41.   </div>
  42.  </div>
  43. </div>
  44.  
  45. <div class="seo-service-content">
  46.  <h3>'.$title.'</h3>
  47.   '.wpautop($desc).'
  48.   <a href="'.$link_source.'" class="service-more-btn">'.$link_text.' <i class="fa fa-angle-right"></i></a>
  49. </div>
  50. </div>
  51.  
  52.  
  53. ';
  54. $seo_service_box_markup .= '';
  55.  
  56. return $seo_service_box_markup;
  57.    
  58. }
  59. add_shortcode('seo_service_box', 'seo_service_box_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement