Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.47 KB | None | 0 0
  1. <?php
  2.  
  3. //my shortcode
  4. function offer_menu($atts, $content = null, $tag)
  5. {
  6. extract(shortcode_atts(array(
  7. 'bg_image' => '',
  8. 'title' => 'Hotel Obaffo',
  9. 'address' => 'London',
  10. 'rating' => '9',
  11. 'price' => '80',
  12. 'priceroomtitle' => 'Price per room per night from',
  13. 'client_url' => 'true',
  14. 'montent' => ''
  15. ), $atts));
  16. $get_bg='';
  17. if (isset($bg_image) && $bg_image != '')
  18. {
  19. $get_bg1 = wp_get_attachment_image_src($bg_image, 'bg_image');
  20. $get_bg=$get_bg1[0];
  21. }
  22. $client_url = vc_build_link($client_url);
  23. $output = '';
  24. $output.='<article class="one-fourth">
  25. <figure>
  26. <a href="' . $client_url['url'] . '" title="">
  27. <img src= "' . $get_bg . '" alt="" />
  28. </a>
  29. </figure>
  30. <div class="details">
  31. <h3>' . $title . '<span class="stars">
  32. <i class="material-icons">&#xE838;</i>
  33. <i class="material-icons">&#xE838;</i>
  34. <i class="material-icons">&#xE838;</i>
  35. <i class="material-icons">&#xE838;</i>
  36. <i class="material-icons">&#xE838;</i>
  37. </span>
  38. </h3>
  39. <span class="address">' . $address . ' • <a href="#">Show on map</a></span>
  40. <span class="rating">' . $rating . '/10</span>
  41. <span class="price">' . $priceroomtitle . '<em>$' . $price . '</em> </span>
  42. <div class="description">
  43. <p>' . $montent . '</p>
  44. </div>
  45.  
  46. <a href="' . $client_url['url'] . '" title="Book now" class="gradient-button" target="">Book now</a>
  47. </div>
  48. </article> ';
  49.  
  50. return $output;
  51. }
  52.  
  53. add_shortcode('offer', 'offer_menu');
  54.  
  55.  
  56.  
  57. ////////////////////
  58.  
  59.  
  60.  
  61.  
  62. vc_map(array(
  63. 'name' => 'View Offer',
  64. 'base' => 'offer',
  65. 'icon' => get_template_directory_uri() . '/img/offer.png',
  66. 'params' => array(
  67. array(
  68. 'param_name' => 'bg_image',
  69. 'type' => 'attach_image',
  70. 'heading' => 'Put an Image',
  71. 'value' => __('')
  72. ),
  73. array(
  74. 'param_name' => 'title',
  75. 'type' => 'textfield',
  76. 'heading' => 'Give a Hotel Name'
  77. ),
  78. array(
  79. 'param_name' => 'address',
  80. 'type' => 'textfield',
  81. 'heading' => 'Write address here'
  82. ),
  83. array(
  84. 'param_name' => 'rating',
  85. 'type' => 'dropdown',
  86. 'heading' => 'Give a rating',
  87. 'value' => array(
  88. '1' => '1',
  89. '2' => '2',
  90. '3' => '3',
  91. '4' => '4',
  92. '5' => '5',
  93. '6' => '6',
  94. '7' => '7',
  95. '8' => '8',
  96. '9' => '9',
  97. '10' => '10'
  98. )
  99. ),
  100. array(
  101. 'param_name' => 'price',
  102. 'type' => 'textfield',
  103. 'heading' => 'Put a price '
  104. ),
  105. array(
  106. 'param_name' => 'montent',
  107. 'type' => 'textarea',
  108. 'heading' => 'Write a brife content '
  109. ),
  110. array(
  111. 'param_name' => 'client_url',
  112. 'type' => 'vc_link',
  113. 'heading' => __('Give a link'),
  114. 'description' => __('Add link to custom heading.', 'js_composer')
  115. ),
  116. array(
  117. 'param_name' => 'priceroomtitle',
  118. 'type' => 'textfield',
  119. 'heading' => 'Put text'
  120. )
  121. )
  122. ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement