Advertisement
Guest User

shortcode_render.php

a guest
Dec 7th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 93.45 KB | None | 0 0
  1. <?php
  2. /* ================================================================================== */
  3. /* Accordion Shortcode
  4. /* ================================================================================== */
  5.  
  6. // Accordion container
  7. if (!function_exists('shortcode_tw_accordion')) {
  8.  
  9. function shortcode_tw_accordion($atts, $content) {
  10. $output = '<div class="tw-accordion">';
  11. $output .= do_shortcode($content);
  12. $output .= '</div>';
  13. return $output;
  14. }
  15.  
  16. }
  17. add_shortcode('tw_accordion', 'shortcode_tw_accordion');
  18. // Accordion Item
  19. if (!function_exists('shortcode_tw_accordion_item')) {
  20.  
  21. function shortcode_tw_accordion_item($atts, $content) {
  22. $expand = (!empty($atts['item_expand']) && $atts['item_expand'] == 'true') ? true : false;
  23. $class = '';
  24. $output = '<div class="accordion-group ' . $class . '">';
  25. $output .= '<div class="accordion-heading">';
  26. $output .= '<a class="accordion-toggle ' . ($expand ? ' active' : '') . '" data-toggle="collapse" data-parent="" href="#">';
  27. $output .= $atts['item_title'];
  28. $output .= '<span class="tw-check"><i class="fa fa-plus"></i><i class="fa fa-minus"></i></span>';
  29. $output .= '</a>';
  30. $output .= '</div>';
  31. $output .= '<div class="accordion-body collapse' . ($expand ? ' in' : '') . '" >';
  32. $output .= '<div class="accordion-inner">';
  33. $output .= apply_filters("the_content", $content);
  34. $output .= '</div>';
  35. $output .= '</div>';
  36. $output .= '</div>';
  37.  
  38.  
  39. return $output;
  40. }
  41.  
  42. }
  43. add_shortcode('tw_accordion_item', 'shortcode_tw_accordion_item');
  44.  
  45.  
  46.  
  47. /* ================================================================================== */
  48. /* List Shortcode
  49. /* ================================================================================== */
  50.  
  51. // List container
  52. if (!function_exists('shortcode_tw_list')) {
  53.  
  54. function shortcode_tw_list($atts, $content) {
  55. $output = '<ul class="tw-list">';
  56. $output .= do_shortcode($content);
  57. $output .= '</ul>';
  58. return $output;
  59. }
  60.  
  61. }
  62. add_shortcode('tw_list', 'shortcode_tw_list');
  63. // List Item
  64. if (!function_exists('shortcode_tw_list_item')) {
  65.  
  66. function shortcode_tw_list_item($atts, $content) {
  67. if (isMobile() && !tw_option('moblile_animation')) {
  68. $atts['item_animation'] = 'none';
  69. }
  70. $class = '';
  71. $animated = false;
  72. if (isset($atts['item_animation']) && $atts['item_animation'] !== 'none') {
  73. $animated = true;
  74. $class .= ' tw-animate-gen';
  75. $atts['item_animation_offset'] = isset($atts['item_animation_offset']) ? str_replace(' ', '', $atts['item_animation_offset']) : '';
  76. $atts['item_animation_offset'] = empty($atts['item_animation_offset']) ? 'bottom-in-view' : $atts['item_animation_offset'];
  77. }
  78. $output = '<li class="' . $class . '"' . ($animated ? ' data-gen="' . $atts['item_animation'] . '" data-gen-offset="' . $atts['item_animation_offset'] . '" style="opacity:0;"' : '') . '><i class="fa ' . $atts['item_icon'] . '"></i>' . do_shortcode($content) . '</li>';
  79. return $output;
  80. }
  81.  
  82. }
  83. add_shortcode('tw_list_item', 'shortcode_tw_list_item');
  84.  
  85.  
  86.  
  87. /* ================================================================================== */
  88. /* Toggle Shortcode
  89. /* ================================================================================== */
  90.  
  91. // Toggle container
  92. if (!function_exists('shortcode_tw_toggle')) {
  93.  
  94. function shortcode_tw_toggle($atts, $content) {
  95. $output = '<div class="tw-toggle">';
  96. $output .= do_shortcode($content);
  97. $output .= '</div>';
  98. return $output;
  99. }
  100.  
  101. }
  102. add_shortcode('tw_toggle', 'shortcode_tw_toggle');
  103. // Toggle Item
  104. if (!function_exists('shortcode_tw_toggle_item')) {
  105.  
  106. function shortcode_tw_toggle_item($atts, $content) {
  107. $expand = (!empty($atts['item_expand']) && $atts['item_expand'] == 'true') ? true : false;
  108. $class = '';
  109. $output = '<div class="accordion-group' . $class . '">';
  110. $output .= '<div class="accordion-heading ' . ($expand ? ' active' : '') . '">';
  111. $output .= '<a class="accordion-toggle toggle ' . ($expand ? ' active' : '') . '" data-toggle="collapse" href="#">';
  112. $output .= $atts['item_title'];
  113. $output .= '<span class="tw-check"><i class="fa fa-plus"></i><i class="fa fa-minus"></i></span>';
  114. $output .= '</a>';
  115. $output .= '</div>';
  116. $output .= '<div class="accordion-body collapse' . ($expand ? ' in' : '') . '" >';
  117. $output .= '<div class="accordion-inner">';
  118. $output .= apply_filters("the_content", $content);
  119. $output .= '</div>';
  120. $output .= '</div>';
  121. $output .= '</div>';
  122.  
  123. return $output;
  124. }
  125.  
  126. }
  127. add_shortcode('tw_toggle_item', 'shortcode_tw_toggle_item');
  128.  
  129.  
  130.  
  131. /* ================================================================================== */
  132. /* Tab Shortcode
  133. /* ================================================================================== */
  134.  
  135. // Tab container
  136. if (!function_exists('shortcode_tw_tab')) {
  137.  
  138. function shortcode_tw_tab($atts, $content) {
  139. $position = (!empty($atts['position']) || $atts['position'] != 'top') ? (' tabs-' . $atts['position']) : '';
  140. $output = '<div class="tw-tab tabbable' . $position . '">';
  141. $output .= do_shortcode($content);
  142. $output .= '<ul class="nav nav-tabs"></ul>';
  143. $output .= '<div class="tab-content"></div>';
  144. $output .= '</div>';
  145. return $output;
  146. }
  147.  
  148. }
  149. add_shortcode('tw_tab', 'shortcode_tw_tab');
  150. // Tab Item
  151. if (!function_exists('shortcode_tw_tab_item')) {
  152.  
  153. function shortcode_tw_tab_item($atts, $content) {
  154. $atts = shortcode_atts(array(
  155. 'title_icon' => '',
  156. 'title' => '',
  157. ), $atts);
  158. $output = '<li>';
  159. $output .= '<a href="">';
  160. if (!empty($atts['title_icon'])) {
  161. $output .= '<i class="fa ' . $atts['title_icon'] . '"></i>';
  162. }
  163. if (!empty($atts['title'])) {
  164. $output .= '<span>' . $atts['title'] . '</span>';
  165. }
  166. $output .= '</a>';
  167. $output .= '</li>';
  168. $output .= '<div class="tab-pane" id="">';
  169. $output .= apply_filters("the_content", $content);
  170. $output .= '</div>';
  171. return $output;
  172. }
  173.  
  174. }
  175. add_shortcode('tw_tab_item', 'shortcode_tw_tab_item');
  176.  
  177.  
  178.  
  179. /* ================================================================================== */
  180. /* Blog Shortcode
  181. /* ================================================================================== */
  182. if (!function_exists('shortcode_tw_blog')) {
  183.  
  184. function shortcode_tw_blog($atts, $content) {
  185. global $paged, $tw_options;
  186. if ( get_query_var('paged') ) {
  187. $paged = get_query_var('paged');
  188. } elseif ( get_query_var('page') ) {
  189. $paged = get_query_var('page');
  190. } else {
  191. $paged = 1;
  192. }
  193. $blogstyle = (empty($atts['layout']) || $atts['layout'] == 'standard') ? 'blog-standard' : 'blog-masonry';
  194. $output = '<div class="tw-blog ' . $blogstyle . '">';
  195. $query = Array(
  196. 'post_type' => 'post',
  197. 'posts_per_page' => $atts['post_count'],
  198. 'paged' => $paged,
  199. );
  200. $cats = empty($atts['category_ids']) ? false : explode(",", $atts['category_ids']);
  201. if ($cats) {
  202. $query['tax_query'] = Array(Array(
  203. 'taxonomy' => 'category',
  204. 'terms' => $cats,
  205. 'field' => 'slug'
  206. )
  207. );
  208. }
  209. $tw_options['show_pagination'] = $atts['pagination'] == 'true' ? true : false;
  210. $tw_options['excerpt_count'] = $atts['excerpt_count'];
  211. $tw_options['more_text'] = $atts['more_text'];
  212.  
  213. $atts['layout'] = !empty($atts['layout']) ? $atts['layout'] : 'standard';
  214.  
  215. if ($atts['layout_size'] === 'span9') {
  216. $tw_options['layout'] = 'standard';
  217. if ($atts['layout'] != 'standard')
  218. $tw_options['layout'] = '3';
  219. }elseif ($atts['layout_size'] === 'span12') {
  220. switch ($atts['layout']) {
  221. case '2': {
  222. $tw_options['layout'] = '6';
  223. break;
  224. }
  225. case '3': {
  226. $tw_options['layout'] = '4';
  227. break;
  228. }
  229. case '4': {
  230. $tw_options['layout'] = '3';
  231. break;
  232. }
  233. case 'standard': {
  234. $tw_options['layout'] = 'standard';
  235. break;
  236. }
  237. }
  238. }
  239.  
  240. if ($tw_options['layout'] != 'standard')
  241. add_action('wp_footer', 'isotope_script');
  242.  
  243. if (!is_tax())
  244. query_posts($query);
  245. ob_start();
  246. get_template_part("loop");
  247. $output .= ob_get_clean();
  248. wp_reset_query();
  249. $output .= '</div>';
  250. return $output;
  251. }
  252.  
  253. }
  254. add_shortcode('tw_blog', 'shortcode_tw_blog');
  255.  
  256.  
  257.  
  258. /* ================================================================================== */
  259. /* Column Shortcode
  260. /* ================================================================================== */
  261. if (!function_exists('shortcode_tw_column')) {
  262.  
  263. function shortcode_tw_column($atts, $content) {
  264. $output = '<div class="tw-content">';
  265. $output .= apply_filters("the_content", $content);
  266. $output .= '</div>';
  267. return $output;
  268. }
  269.  
  270. }
  271. add_shortcode('tw_column', 'shortcode_tw_column');
  272.  
  273.  
  274.  
  275. /* ================================================================================== */
  276. /* Item Shortcode Container
  277. /* ================================================================================== */
  278. if (!function_exists('shortcode_tw_item')) {
  279.  
  280. function shortcode_tw_item($atts, $content) {
  281. if ($atts['row_type'] === 'row') {
  282. $atts['size'] = $atts['layout_size'];
  283. } else {
  284. if ($atts['layout_size'] === 'span3') {
  285. $atts['size'] = 'span12';
  286. }
  287. }
  288. if (isMobile() && !tw_option('moblile_animation')) {
  289. $atts['item_animation'] = 'none';
  290. }
  291. $class = '';
  292. $animated = false;
  293. if (isset($atts['item_animation']) && $atts['item_animation'] !== 'none') {
  294. $animated = true;
  295. $class .= ' tw-animate-gen';
  296. $atts['item_animation_offset'] = isset($atts['item_animation_offset']) ? str_replace(' ', '', $atts['item_animation_offset']) : '';
  297. $atts['item_animation_offset'] = empty($atts['item_animation_offset']) ? 'bottom-in-view' : $atts['item_animation_offset'];
  298. }
  299.  
  300. $output = '<div class="tw-element ' . $atts['size'] . ' ' . $atts['class'] . $class . '" ' . ($animated ? 'data-gen="' . $atts['item_animation'] . '" data-gen-offset="' . $atts['item_animation_offset'] . '" style="opacity:0;"' : '') . '>' . do_shortcode($content) . '</div>';
  301. return $output;
  302. }
  303.  
  304. }
  305. add_shortcode('tw_item', 'shortcode_tw_item');
  306.  
  307.  
  308.  
  309. /* ================================================================================== */
  310. /* Item Title Shortcode
  311. /* ================================================================================== */
  312. if (!function_exists('shortcode_tw_item_title')) {
  313.  
  314. function shortcode_tw_item_title($atts, $content) {
  315. $output = '<div class="tw-title-container"><h3 class="tw-title">' . rawUrlDecode($atts['title']) . '</h3><span class="tw-title-border"></span></div>';
  316. return $output;
  317. }
  318.  
  319. }
  320. add_shortcode('tw_item_title', 'shortcode_tw_item_title');
  321.  
  322.  
  323.  
  324.  
  325. /* ================================================================================== */
  326. /* Layout Shortcode
  327. /* ================================================================================== */
  328. if (!function_exists('shortcode_tw_layout')) {
  329.  
  330. function shortcode_tw_layout($atts, $content) {
  331. $style = '';
  332. if (isset($atts['padding_top']) || isset($atts['padding_bottom'])) {
  333. $padding_top = isset($atts['padding_top']) ? (' margin-top:' . $atts['padding_top'] . 'px;') : '';
  334. $padding_bottom = isset($atts['padding_bottom']) ? (' margin-bottom:' . $atts['padding_bottom'] . 'px;') : '';
  335. $style = ' style="' . $padding_top . $padding_bottom . '"';
  336. }
  337. $output = '<div class="' . pbTextToFoundation($atts['size']) . ' ' . $atts['layout_custom_class'] . '"' . $style . '>' . do_shortcode($content) . '</div>';
  338. return $output;
  339. }
  340.  
  341. }
  342. add_shortcode('tw_layout', 'shortcode_tw_layout');
  343.  
  344.  
  345.  
  346. /* ================================================================================== */
  347. /* Core Content Shortcode
  348. /* ================================================================================== */
  349. if (!function_exists('shortcode_tw_content')) {
  350.  
  351. function shortcode_tw_content() {
  352. $output = '<div class="tw-content">';
  353. $output .= apply_filters("the_content", get_the_content());
  354. $output .= '</div>';
  355. return $output;
  356. }
  357.  
  358. }
  359. add_shortcode('tw_content', 'shortcode_tw_content');
  360.  
  361.  
  362.  
  363. /* ================================================================================== */
  364. /* Service Shortcode
  365. /* ================================================================================== */
  366. if (!function_exists('shortcode_tw_service')) {
  367.  
  368. function shortcode_tw_service($atts, $content) {
  369. $output = '<div class="tw-service">';
  370. $output .= do_shortcode($content);
  371. $output .= '</div>';
  372. return $output;
  373. }
  374.  
  375. }
  376. add_shortcode('tw_service', 'shortcode_tw_service');
  377.  
  378.  
  379.  
  380. // Service Item
  381. if (!function_exists('shortcode_tw_service_item')) {
  382.  
  383. function shortcode_tw_service_item($atts, $content) {
  384. $thumb = '';
  385. $thumbType = isset($atts['thumb_type']) ? $atts['thumb_type'] : 'fa';
  386. $style_for_desc = '';
  387. $margin_for_desc = '';
  388. $margin_top = $icon_top = '';
  389. switch($atts['service_style']) {
  390. case 'style_4': $class = 'style-4'; break;
  391. case 'style_3': $class = 'style-3'; break;
  392. case 'style_2': $class = 'style-2'; break;
  393. default: $class = 'style-1'; break;
  394. }
  395. if ($class === 'style-2' || $class === 'style-3') {
  396. $class .= ' left-service';
  397. $style_for_desc = 'desc_unstyle';
  398. $margin_for_desc = 'margin-left:' . ($thumbType === 'fa' ? ($atts['fa_size'] + $atts['fa_padding'] + $atts['fa_padding'] + ($atts['fa_rounded'] * 2) + 20) : ($thumbType === 'image' ? (intval($atts['service_thumb_width']) + 30) : (intval($atts['cc_size']) + 15))) . 'px;';
  399. } elseif($class === 'style-4') {
  400. $iconheight = ($thumbType === 'fa' ? (($atts['fa_size'] + $atts['fa_padding'] + $atts['fa_padding'] + ($atts['fa_rounded'] * 2))/2) : ($thumbType === 'image' ? (intval($atts['service_thumb_width'])/2) : (intval($atts['cc_size'])/2)));
  401. $margin_top = 'margin-top:' . $iconheight . 'px;';
  402. $icon_top = ' style="margin-top:-' . $iconheight . 'px;"';
  403. }
  404. if ($thumbType === 'image') {
  405. $thumb = isset($atts['service_thumb']) ? '<img title="' . $atts['title'] . '" width="' . $atts['service_thumb_width'] . '" src="' . $atts['service_thumb'] . '" />' : '';
  406. } elseif ($thumbType === 'fa') {
  407. $thumb = do_shortcode('[tw_fontawesome fa_size="' . $atts['fa_size'] . '" fa_padding="' . $atts['fa_padding'] . '" fa_color="' . $atts['fa_color'] . '" fa_bg_color="' . $atts['fa_bg_color'] . '" fa_border_color="' . $atts['fa_border_color'] . '" fa_rounded="' . $atts['fa_rounded'] . '" fa_rounded_size="' . $atts['fa_rounded_size'] . '" fa_icon="' . $atts['fa_icon'] . '"]');
  408. } elseif ($thumbType === 'cc') {
  409. $thumb = do_shortcode('[tw_chart_circle cc_type="' . $atts['cc_type'] . '" cc_line_width="' . $atts['cc_line_width'] . '" cc_text="' . $atts['cc_text'] . '" cc_percent="' . $atts['cc_percent'] . '" cc_size="' . $atts['cc_size'] . '" cc_font_size="' . $atts['cc_font_size'] . '" cc_font_color="' . $atts['cc_font_color'] . '" cc_color="' . $atts['cc_color'] . '" cc_track_color="' . $atts['cc_track_color'] . '" cc_icon="' . $atts['cc_icon'] . '"]');
  410. }
  411. if (isMobile() && !tw_option('moblile_animation')) {
  412. $atts['item_animation'] = 'none';
  413. }
  414. $animated = false;
  415. if (isset($atts['item_animation']) && $atts['item_animation'] !== 'none') {
  416. $animated = true;
  417. $class .= ' tw-animate-gen';
  418. $atts['item_animation_offset'] = isset($atts['item_animation_offset']) ? str_replace(' ', '', $atts['item_animation_offset']) : '';
  419. $atts['item_animation_offset'] = empty($atts['item_animation_offset']) ? 'bottom-in-view' : $atts['item_animation_offset'];
  420. }
  421.  
  422. $output = '<div class="tw-service-box ' . $class . '"' . ($animated ? ' data-gen="' . $atts['item_animation'] . '" data-gen-offset="' . $atts['item_animation_offset'] . '" style="opacity:0;'.$margin_top.'"' : (!empty($margin_top) ? ' style="'.$margin_top.'"' : '')) . '>';
  423. $output .= '<div class="tw-service-icon"'.$icon_top.'>' . $thumb . '</div>';
  424. $output .= '<div class="tw-service-content ' . $style_for_desc . '"' . ($atts['service_style'] === 'style_2' ? (' style="' . $margin_for_desc . '"') : '') . '>';
  425. $output .= '<h3' . ($atts['service_style'] === 'style_3' ? (' style="' . $margin_for_desc . '"') : '') . '>' . $atts['title'] . '</h3>';
  426. $output .= $atts['service_style'] === 'style_3' ? ('<div class="clearfix"></div>') : '';
  427. if (do_shortcode($content) != '')
  428. $output .= '<p>' . do_shortcode($content) . '</p>';
  429. if (!empty($atts['more_url']))
  430. $output .= '<a href="' . $atts['more_url'] . '" target="' . $atts['more_target'] . '">' . $atts['more_text'] . '</a>';
  431. $output .= '</div>';
  432. $output .= "</div>";
  433. return $output;
  434. }
  435.  
  436. }
  437. add_shortcode('tw_service_item', 'shortcode_tw_service_item');
  438.  
  439.  
  440.  
  441. /* ================================================================================== */
  442. /* Milestones Shortcode
  443. /* ================================================================================== */
  444. if (!function_exists('shortcode_tw_milestones')) {
  445.  
  446. function shortcode_tw_milestones($atts, $content) {
  447. $output = '<div class="tw-milestones">';
  448. $output .= do_shortcode($content);
  449. $output .= '</div>';
  450. return $output;
  451. }
  452.  
  453. }
  454. add_shortcode('tw_milestones', 'shortcode_tw_milestones');
  455.  
  456. // Milestones Item
  457. if (!function_exists('shortcode_tw_milestones_item')) {
  458.  
  459. function shortcode_tw_milestones_item($atts, $content) {
  460. $atts['thumb_type'] = isset($atts['thumb_type']) ? $atts['thumb_type'] : 'fa';
  461. $thumb = '';
  462. if ($atts['thumb_type'] === 'fa') {
  463. $thumb = do_shortcode('[tw_fontawesome fa_size="' . $atts['fa_size'] . '" fa_padding="' . $atts['fa_padding'] . '" fa_color="' . $atts['fa_color'] . '" fa_bg_color="' . $atts['fa_bg_color'] . '" fa_border_color="' . $atts['fa_border_color'] . '" fa_rounded="' . $atts['fa_rounded'] . '" fa_rounded_size="' . $atts['fa_rounded_size'] . '" fa_icon="' . $atts['fa_icon'] . '"]');
  464. } else {
  465. $thumb = '<img src="' . $atts['image'] . '" />';
  466. }
  467. if (isMobile() && !tw_option('moblile_animation')) {
  468. $atts['item_animation'] = 'none';
  469. }
  470. $class = '';
  471. $class2 = '';
  472. $animated = false;
  473. if (isset($atts['item_animation']) && $atts['item_animation'] !== 'none') {
  474. $animated = true;
  475. $class .= ' tw-animate-gen';
  476. $atts['item_animation_offset'] = isset($atts['item_animation_offset']) ? str_replace(' ', '', $atts['item_animation_offset']) : '';
  477. $atts['item_animation_offset'] = empty($atts['item_animation_offset']) ? 'bottom-in-view' : $atts['item_animation_offset'];
  478. }
  479. if ($atts['milsetone_type'] == 'style_1') {
  480. $class2 .= 'centered';
  481. } else {
  482. $class2 .= 'float-left';
  483. }
  484. $output = '<div class="tw-milestones-box tw-animate' . $class . '"' . ($animated ? ' data-gen="' . $atts['item_animation'] . '" data-gen-offset="' . $atts['item_animation_offset'] . '" style="opacity:0;"' : '') . '>';
  485. $output .= '<div class="tw-milestones-icon ' . $class2 . '">' . $thumb . '</div>';
  486. $output .= '<div class="tw-milestones-content ' . $class2 . '">';
  487. $output .= '<div class="tw-milestones-count clearfix">';
  488. foreach (str_split($atts['count']) as $count) {
  489. $output .= '<div class="tw-milestones-show">';
  490. $output .= '<ul class="">';
  491. $count = intval($count);
  492. for ($i = 0; $i <= $count; $i++) {
  493. $output .= '<li class="">';
  494. $output .= $i;
  495. $output .= '</li>';
  496. }
  497. $output .= '</ul>';
  498. $output .= '</div>';
  499. }
  500. $output .= '</div>';
  501. $output .= '<p>' . $atts['title'] . '</p>';
  502. $output .= '</div>';
  503. $output .= '</div>';
  504. return $output;
  505. }
  506.  
  507. }
  508. add_shortcode('tw_milestones_item', 'shortcode_tw_milestones_item');
  509.  
  510.  
  511.  
  512. /* ================================================================================== */
  513. /* Font Awesome Shortcode
  514. /* ================================================================================== */
  515. if (!function_exists('shortcode_tw_fontawesome')) {
  516.  
  517. function shortcode_tw_fontawesome($atts, $content) {
  518. $atts['fa_size'] = str_replace('px', '', $atts['fa_size']);
  519. $atts['fa_padding'] = str_replace('px', '', $atts['fa_padding']);
  520. $atts['fa_rounded'] = str_replace('px', '', $atts['fa_rounded']);
  521. $atts['fa_rounded_size'] = str_replace('px', '', $atts['fa_rounded_size']);
  522. $style = 'text-align:center;';
  523. $style .='font-size:' . $atts['fa_size'] . 'px;';
  524. $style .='width:' . $atts['fa_size'] . 'px;';
  525. $style .='line-height:' . $atts['fa_size'] . 'px;';
  526. $style .='padding:' . $atts['fa_padding'] . 'px;';
  527. $style .='color:' . $atts['fa_color'] . ';';
  528. $style .='background-color:' . $atts['fa_bg_color'] . ';';
  529. $style .='border-color:' . $atts['fa_border_color'] . ';';
  530. $style .='border-width:' . $atts['fa_rounded'] . 'px;';
  531. $style .='border-radius:' . $atts['fa_rounded_size'] . 'px;';
  532. $style .='-webkit-border-radius:' . $atts['fa_rounded_size'] . 'px;';
  533. $style .='-moz-border-radius:' . $atts['fa_rounded_size'] . 'px;';
  534. $output = '<i class="tw-font-awesome fa ' . $atts['fa_icon'] . '" style="display: inline-block;border-style: solid;' . $style . '"></i>';
  535. return $output;
  536. }
  537.  
  538. }
  539. add_shortcode('tw_fontawesome', 'shortcode_tw_fontawesome');
  540.  
  541.  
  542.  
  543. /* ================================================================================== */
  544. /* Chart Circle Shortcode
  545. /* ================================================================================== */
  546. if (!function_exists('shortcode_tw_chart_circle')) {
  547.  
  548. function shortcode_tw_chart_circle($atts, $content) {
  549. wp_enqueue_script('easy-pie-chart', THEME_DIR . '/assets/js/jquery.easy-pie-chart.js', false, false, true);
  550. $atts = shortcode_atts(array(
  551. 'cc_type' => 'cc',
  552. 'cc_line_width' => '10',
  553. 'cc_text' => '40%',
  554. 'cc_percent' => '40',
  555. 'cc_size' => '100',
  556. 'cc_font_size' => '24',
  557. 'cc_font_color' => '#000',
  558. 'cc_color' => '#ecf0f1',
  559. 'cc_track_color' => '#FF5744',
  560. 'cc_icon' => 'fa fa-umbrella',
  561. 'item_animation_offset' => '',
  562. 'chart_circle_pos' => 'style_1',
  563. ), $atts);
  564. if (isMobile() && !tw_option('moblile_animation')) {
  565. $atts['item_animation_offset'] = 'none';
  566. }
  567. $atts['item_animation_offset'] = isset($atts['item_animation_offset']) ? str_replace(' ', '', $atts['item_animation_offset']) : '';
  568. $atts['item_animation_offset'] = empty($atts['item_animation_offset']) ? 'bottom-in-view' : $atts['item_animation_offset'];
  569.  
  570. $style = 'display:block; text-align:center; margin: 0 auto;';
  571. $style.='width:' . $atts['cc_size'] . 'px;';
  572. $style.='line-height:' . $atts['cc_size'] . 'px;';
  573. $cStyle = '';
  574. $cStyle.='color:' . $atts['cc_font_color'] . ';';
  575. $cStyle.='font-size:' . $atts['cc_font_size'] . 'px;';
  576. $data = '';
  577. $data .= ' data-percent="0"';
  578. $data .= ' data-percent-update="' . $atts['cc_percent'] . '"';
  579. $data .= ' data-line-width="' . $atts['cc_line_width'] . '"';
  580. $data .= ' data-size="' . $atts['cc_size'] . '"';
  581. $data .= ' data-color="' . $atts['cc_color'] . '"';
  582. $data .= ' data-track-color="' . $atts['cc_track_color'] . '"';
  583. $data .= ' data-gen-offset="' . $atts['item_animation_offset'] . '"';
  584. $output = '';
  585. if ($atts['chart_circle_pos'] === 'style_2') {
  586. $output .='<div class="tw-circle-chart tw-animate style_2"' . $data . '>';
  587. } else {
  588. $output .='<div class="tw-circle-chart tw-animate"' . $data . '>';
  589. }
  590. $output .='<span style="' . $cStyle . '">';
  591. if ($atts['cc_type'] === 'fa') {
  592. $output .='<i class="fa ' . $atts['cc_icon'] . '" style="' . $style . '"></i>';
  593. } else {
  594. $output .=$atts['cc_text'];
  595. }
  596. $output .='</span>';
  597. $output .='</div>';
  598. return $output;
  599. }
  600.  
  601. }
  602. add_shortcode('tw_chart_circle', 'shortcode_tw_chart_circle');
  603.  
  604.  
  605.  
  606. /* ================================================================================== */
  607. /* Chart Graph Shortcode
  608. /* ================================================================================== */
  609.  
  610. // Chart Graph Container
  611. if (!function_exists('shortcode_tw_chart_graph')) {
  612.  
  613. function shortcode_tw_chart_graph($atts, $content) {
  614. wp_enqueue_script('chart', THEME_DIR . '/assets/js/Chart.min.js', false, false, true);
  615. $atts = shortcode_atts(array(
  616. 'labels' => '',
  617. 'item_height' => '',
  618. 'type' => 'Line',
  619. 'begin_at_zero' => 'false',
  620. 'item_animation_offset' => '',
  621. ), $atts);
  622. if (isMobile() && !tw_option('moblile_animation')) {
  623. $atts['item_animation_offset'] = 'none';
  624. }
  625. $atts['item_animation_offset'] = isset($atts['item_animation_offset']) ? str_replace(' ', '', $atts['item_animation_offset']) : '';
  626. $atts['item_animation_offset'] = empty($atts['item_animation_offset']) ? 'bottom-in-view' : $atts['item_animation_offset'];
  627.  
  628. $atts['item_height'] = str_replace(' ', '', $atts['item_height']);
  629. $output = '<div class="tw-chart-graph tw-animate tw-redraw not-drawed" data-zero="' . $atts['begin_at_zero'] . '" data-labels="' . $atts['labels'] . '" data-type="' . $atts['type'] . '" data-gen-offset="' . $atts['item_animation_offset'] . '" data-item-height="' . $atts['item_height'] . '">';
  630. $output .= '<ul style="display:none;" class="data">';
  631. $output .= do_shortcode($content);
  632. $output .= '</ul>';
  633. $output .= '<canvas></canvas>';
  634. $output .= '</div>';
  635. return $output;
  636. }
  637.  
  638. }
  639. add_shortcode('tw_chart_graph', 'shortcode_tw_chart_graph');
  640. // Chart Graph Item
  641. if (!function_exists('shortcode_tw_chart_graph_item')) {
  642.  
  643. function shortcode_tw_chart_graph_item($atts, $content) {
  644. $atts = shortcode_atts(array(
  645. 'datas' => '',
  646. 'fill_color' => '',
  647. 'fill_text' => '',
  648. ), $atts);
  649. $output = '<li data-datas="' . $atts['datas'] . '" data-fill-color="' . $atts['fill_color'] . '" data-fill-text="' . $atts['fill_text'] . '"></li>';
  650. return $output;
  651. }
  652.  
  653. }
  654. add_shortcode('tw_chart_graph_item', 'shortcode_tw_chart_graph_item');
  655.  
  656.  
  657.  
  658. /* ================================================================================== */
  659. /* Chart Pie Shortcode
  660. /* ================================================================================== */
  661.  
  662. // Chart Pie Container
  663. if (!function_exists('shortcode_tw_chart_pie')) {
  664.  
  665. function shortcode_tw_chart_pie($atts, $content) {
  666. wp_enqueue_script('chart', THEME_DIR . '/assets/js/Chart.min.js', false, false, true);
  667. $atts = shortcode_atts(array(
  668. 'type' => 'PolarArea',
  669. 'begin_at_zero' => 'false',
  670. 'label_list' => 'false',
  671. 'item_animation_offset' => '',
  672. ), $atts);
  673. if (isMobile() && !tw_option('moblile_animation')) {
  674. $atts['item_animation_offset'] = 'none';
  675. }
  676. $atts['item_animation_offset'] = isset($atts['item_animation_offset']) ? str_replace(' ', '', $atts['item_animation_offset']) : '';
  677. $atts['item_animation_offset'] = empty($atts['item_animation_offset']) ? 'bottom-in-view' : $atts['item_animation_offset'];
  678. $output = '<div class="tw-chart-pie tw-animate tw-redraw not-drawed" data-labellist="' . $atts['label_list'] . '" data-zero="' . $atts['begin_at_zero'] . '" data-type="' . $atts['type'] . '" data-gen-offset="' . $atts['item_animation_offset'] . '">';
  679. $output .= '<ul style="display:none;" class="data">';
  680. $output .= do_shortcode($content);
  681. $output .= '</ul>';
  682. $output .= '<canvas></canvas>';
  683. $output .= '</div>';
  684. return $output;
  685. }
  686.  
  687. }
  688. add_shortcode('tw_chart_pie', 'shortcode_tw_chart_pie');
  689. // Chart Pie Item
  690. if (!function_exists('shortcode_tw_chart_pie_item')) {
  691.  
  692. function shortcode_tw_chart_pie_item($atts, $content) {
  693. $atts = shortcode_atts(array(
  694. 'value' => '',
  695. 'color' => '',
  696. 'fill_text' => '',
  697. ), $atts);
  698. $output = '<li data-value="' . $atts['value'] . '" data-color="' . $atts['color'] . '" data-fill-text="' . $atts['fill_text'] . '"></li>';
  699. return $output;
  700. }
  701.  
  702. }
  703. add_shortcode('tw_chart_pie_item', 'shortcode_tw_chart_pie_item');
  704.  
  705.  
  706.  
  707. /* ================================================================================== */
  708. /* Divider Shortcode
  709. /* ================================================================================== */
  710.  
  711. if (!function_exists('shortcode_tw_divider')) {
  712.  
  713. function shortcode_tw_divider($atts, $content) {
  714. if ($atts['type'] == 'space')
  715. $output = '<div class="tw-divider-space" style="margin-bottom:' . $atts['height'] . 'px;"></div>';
  716. else
  717. $output = '<div class="tw-divider" style="margin-bottom:' . $atts['height']/2 . 'px;margin-top:' . $atts['height']/2 . 'px;"></div>';
  718. return $output;
  719. }
  720.  
  721. }
  722. add_shortcode('tw_divider', 'shortcode_tw_divider');
  723.  
  724.  
  725.  
  726.  
  727.  
  728. /* ================================================================================== */
  729. /* Image Slider Shortcode
  730. /* ================================================================================== */
  731. // Image Slider Container
  732. if (!function_exists('shortcode_tw_image_slider')) {
  733. function shortcode_tw_image_slider($atts, $content) {
  734. $output = '<div class="gallery-container clearfix">';
  735. $output .= '<div class="gallery-slide">';
  736. $output .= do_shortcode($content);
  737. $output .= '</div>';
  738. $output .= '<div class="carousel-arrow">';
  739. $output .= '<a class="carousel-prev" href="#"><i class="fa fa-chevron-left"></i></a>';
  740. $output .= '<a class="carousel-next" href="#"><i class="fa fa-chevron-right"></i></a>';
  741. $output .= '</div>';
  742. $output .= '</div>';
  743. return $output;
  744. }
  745. }
  746. add_shortcode('tw_image_slider', 'shortcode_tw_image_slider');
  747. // Image Slider Item
  748. if (!function_exists('shortcode_tw_image_slider_item')) {
  749. function shortcode_tw_image_slider_item($atts, $content) {
  750. $output = '<div class="slide-item">';
  751. $output .= '<img src="' . $atts['url'] . '" alt="' . get_the_title() . '" style="width:100%;">';
  752. $output .= '</div>';
  753. return $output;
  754. }
  755. }
  756. add_shortcode('tw_image_slider_item', 'shortcode_tw_image_slider_item');
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788. /* ================================================================================== */
  789. /* Messagebox Shortcode
  790. /* ================================================================================== */
  791.  
  792. // Messagebox container
  793. if (!function_exists('shortcode_message_box')) {
  794.  
  795. function shortcode_message_box($atts, $content) {
  796. $output = '<div class="tw-message-box">';
  797. $output .= do_shortcode($content);
  798. $output .= '</div>';
  799. return $output;
  800. }
  801.  
  802. }
  803. add_shortcode('tw_message_box', 'shortcode_message_box');
  804. // Messagebox Item
  805. if (!function_exists('shortcode_tw_message_box_item')) {
  806.  
  807. function shortcode_tw_message_box_item($atts, $content) {
  808. $type = "alert-default";
  809. if ($atts['type'] == 'Default') {
  810.  
  811. } elseif ($atts['type'] == 'Warning') {
  812. $type = "alert-warning";
  813. } elseif ($atts['type'] == 'Information') {
  814. $type = "alert-info";
  815. } elseif ($atts['type'] == 'Success') {
  816. $type = "alert-success";
  817. } elseif ($atts['type'] == 'Error') {
  818. $type = "alert-error";
  819. }
  820. if (isMobile() && !tw_option('moblile_animation')) {
  821. $atts['item_animation'] = 'none';
  822. }
  823. $class = '';
  824. $animated = false;
  825. if (isset($atts['item_animation']) && $atts['item_animation'] !== 'none') {
  826. $animated = true;
  827. $class .= ' tw-animate-gen';
  828. $atts['item_animation_offset'] = isset($atts['item_animation_offset']) ? str_replace(' ', '', $atts['item_animation_offset']) : '';
  829. $atts['item_animation_offset'] = empty($atts['item_animation_offset']) ? 'bottom-in-view' : $atts['item_animation_offset'];
  830. }
  831. $output = '<div class="alert ' . $type . $class . '"' . ($animated ? ' data-gen="' . $atts['item_animation'] . '" data-gen-offset="' . $atts['item_animation_offset'] . '" style="opacity:0;"' : '') . '>';
  832. $output .= '<button type="button" class="close" data-dismiss="alert">&times;</button>';
  833. $output .= do_shortcode($content);
  834. $output .= '</div>';
  835.  
  836. return $output;
  837. }
  838.  
  839. }
  840. add_shortcode('tw_message_box_item', 'shortcode_tw_message_box_item');
  841.  
  842.  
  843.  
  844. /* ================================================================================== */
  845. /* Progress Shortcode
  846. /* ================================================================================== */
  847. if (!function_exists('shortcode_tw_progress')) {
  848.  
  849. function shortcode_tw_progress($atts, $content) {
  850. return do_shortcode($content);
  851. }
  852.  
  853. }
  854. add_shortcode('tw_progress', 'shortcode_tw_progress');
  855. if (!function_exists('shortcode_tw_progress_item')) {
  856.  
  857. function shortcode_tw_progress_item($atts, $content) {
  858. if (isMobile() && !tw_option('moblile_animation')) {
  859. $atts['item_animation'] = 'none';
  860. }
  861. $class = '';
  862. $animated = false;
  863. $hundred = '';
  864. if ($atts['percent'] === '100') {
  865. $hundred = "full";
  866. }
  867. if (isset($atts['item_animation']) && $atts['item_animation'] !== 'none') {
  868. $animated = true;
  869. $class .= ' tw-animate-gen';
  870. $atts['item_animation_offset'] = isset($atts['item_animation_offset']) ? str_replace(' ', '', $atts['item_animation_offset']) : '';
  871. $atts['item_animation_offset'] = empty($atts['item_animation_offset']) ? 'bottom-in-view' : $atts['item_animation_offset'];
  872. }
  873. $output = '<div class="progress' . $class . '"' . ($animated ? ' data-gen="' . $atts['item_animation'] . '" data-gen-offset="' . $atts['item_animation_offset'] . '" style="opacity:0;"' : '') . '>';
  874. if ($atts['type'] == 'animated')
  875. $output = '<div class="progress progress-striped active' . $class . '"' . ($animated ? ' data-gen="' . $atts['item_animation'] . '" data-gen-offset="' . $atts['item_animation_offset'] . '" style="opacity:0;"' : '') . '>';
  876. elseif ($atts['type'] == 'striped')
  877. $output = '<div class="progress progress-striped' . $class . '"' . ($animated ? ' data-gen="' . $atts['item_animation'] . '" data-gen-offset="' . $atts['item_animation_offset'] . '" style="opacity:0;"' : '') . '>';
  878. $output .= '<div class="title">' . $atts['progress_title'] . '</div><span>' . $atts['percent'] . '%</span>';
  879. $output .= '<div class="bar-container"><div class="' . $hundred . ' bar ' . ($atts['type'] == 'default' ? 'tw-bi' : '') . '" style="width: ' . $atts['percent'] . '%;background-color: ' . $atts['color'] . '"></div></div>';
  880. $output .= '</div>';
  881. return $output;
  882. }
  883.  
  884. }
  885. add_shortcode('tw_progress_item', 'shortcode_tw_progress_item');
  886.  
  887.  
  888.  
  889.  
  890. /* ================================================================================== */
  891. /* Sidebar Shortcode
  892. /* ================================================================================== */
  893. if (!function_exists('shortcode_tw_sidebar')) {
  894.  
  895. function shortcode_tw_sidebar($atts, $content) {
  896. ob_start();
  897. echo '<section id="sidebar">';
  898. if (!dynamic_sidebar($atts['name'])) {
  899. print 'There is no widget. You should add your widgets into <strong>';
  900. print $atts['name'];
  901. print '</strong> sidebar area on <strong>Appearance => Widgets</strong> of your dashboard. <br/><br/>';
  902. }
  903. echo '</section>';
  904. $output = ob_get_clean();
  905. return $output;
  906. }
  907.  
  908. }
  909. add_shortcode('tw_sidebar', 'shortcode_tw_sidebar');
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916. /* ================================================================================== */
  917. /* Video Shortcode
  918. /* ================================================================================== */
  919. if (!function_exists('shortcode_tw_video')) {
  920.  
  921. function shortcode_tw_video($atts, $content) {
  922.  
  923. $video_embed = $content;
  924. $video_thumb = $atts['video_thumb'];
  925. $video_m4v = $atts['video_m4v'];
  926. $video_type = $atts['insert_type'];
  927.  
  928. ob_start();
  929.  
  930. if ($video_type == 'type_embed') {
  931. echo apply_filters("the_content", $video_embed);
  932. } elseif (!empty($video_m4v)) {
  933. global $post;
  934. add_action('wp_footer', 'jplayer_script');
  935. ?>
  936.  
  937. <div id="jquery_jplayer_<?php echo $post->ID; ?>" class="jp-jplayer jp-jplayer-video" data-pid="<?php echo $post->ID; ?>" data-m4v="<?php echo $video_m4v; ?>" data-thumb="<?php echo $video_thumb; ?>"></div>
  938. <div class="jp-video-container">
  939. <div class="jp-video">
  940. <div class="jp-type-single">
  941. <div id="jp_interface_<?php echo $post->ID; ?>" class="jp-interface">
  942. <ul class="jp-controls">
  943. <li><div class="seperator-first"></div></li>
  944. <li><div class="seperator-second"></div></li>
  945. <li><a href="#" class="jp-play" tabindex="1">play</a></li>
  946. <li><a href="#" class="jp-pause" tabindex="1">pause</a></li>
  947. <li><a href="#" class="jp-mute" tabindex="1">mute</a></li>
  948. <li><a href="#" class="jp-unmute" tabindex="1">unmute</a></li>
  949. </ul>
  950. <div class="jp-progress-container">
  951. <div class="jp-progress">
  952. <div class="jp-seek-bar">
  953. <div class="jp-play-bar"></div>
  954. </div>
  955. </div>
  956. </div>
  957. <div class="jp-volume-bar-container">
  958. <div class="jp-volume-bar">
  959. <div class="jp-volume-bar-value"></div>
  960. </div>
  961. </div>
  962. </div>
  963. </div>
  964. </div>
  965. </div>
  966. <?php
  967. }
  968. $output = ob_get_clean();
  969. return $output;
  970. }
  971.  
  972. }
  973. add_shortcode('tw_video', 'shortcode_tw_video');
  974.  
  975.  
  976.  
  977.  
  978.  
  979. /* ================================================================================== */
  980. /* Callout Shortcode
  981. /* ================================================================================== */
  982.  
  983. if (!function_exists('shortcode_tw_callout')) {
  984.  
  985. function shortcode_tw_callout($atts, $content) {
  986. $Callout_icon = '';
  987. if (!empty($atts['btn_icon'])) {
  988. $Callout_icon .= '<i class="fa ' . $atts['btn_icon'] . '"></i>';
  989. }
  990. $Callout_style = isset($atts['callout_style']) ? $atts['callout_style'] : '';
  991. $Callout_bt = isset($atts['btn_text']) ? $atts['btn_text'] : '';
  992. $Callout_bt_url = !empty($atts['btn_url']) ? $atts['btn_url'] : '#';
  993. $Callout_bt_color = !empty($atts['btn_url']) ? (' style="background-color:' . $atts['btn_color'] . ';border-color:' . $atts['btn_color'] . '"') : '#';
  994. $Callout_bt_target = isset($atts['btn_target']) ? $atts['btn_target'] : '_blank';
  995. $Callout_bt_full = '<a href="' . $Callout_bt_url . '"' . $Callout_bt_color . ' target="' . $Callout_bt_target . '" class="btn rounded btn-flat btn-large">' . $Callout_icon . $Callout_bt . '</a>';
  996.  
  997. $output = '<div class="' . $Callout_style . ' tw-callout' . (!empty($Callout_bt) ? ' with-button' : '') . '">';
  998. $output .= '<div class="callout-text">';
  999. $output .= '<h1>' . do_shortcode($content) . '</h1>';
  1000. $output .= '<p>' . $atts['callout_description'] . '</p>';
  1001. $output .=!empty($Callout_bt) ? $Callout_bt_full : '';
  1002. $output .= '</div>';
  1003. $output .= '</div>';
  1004.  
  1005. return $output;
  1006. }
  1007.  
  1008. }
  1009. add_shortcode('tw_callout', 'shortcode_tw_callout');
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015. /* ================================================================================== */
  1016. /* Revolution Slider Shortcode
  1017. /* ================================================================================== */
  1018.  
  1019. if (!function_exists('shortcode_tw_slider')) {
  1020.  
  1021. function shortcode_tw_slider($atts, $content) {
  1022. if ($atts["id"] > 0) {
  1023. $output = do_shortcode('[layerslider id="' . $atts["id"] . '"]');
  1024. } else {
  1025. $output = '<pre>' . __('Choose Slider', 'medusa') . '</pre>';
  1026. }
  1027.  
  1028. return $output;
  1029. }
  1030.  
  1031. }
  1032. add_shortcode('tw_slider', 'shortcode_tw_slider');
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038. /* ================================================================================== */
  1039. /* Pricing Table Shortcode
  1040. /* ================================================================================== */
  1041.  
  1042. if (!function_exists('shortcode_tw_pricing_table')) {
  1043.  
  1044. function shortcode_tw_pricing_table($atts, $content) {
  1045. $output = '<div class="tw-pricing clearfix">';
  1046. $query = Array(
  1047. 'post_type' => 'tw_price',
  1048. 'posts_per_page' => $atts['column'],
  1049. );
  1050. $cats = empty($atts['price_category_list']) ? false : explode(",", $atts['price_category_list']);
  1051. if ($cats) {
  1052. $query['tax_query'] = Array(Array(
  1053. 'taxonomy' => 'cat_price',
  1054. 'terms' => $cats,
  1055. 'field' => 'slug'
  1056. )
  1057. );
  1058. }
  1059. switch ($atts['column']) {
  1060. case'2': {
  1061. $columnWidth = 'tw-pricing-two';
  1062. break;
  1063. }
  1064. case'3': {
  1065. $columnWidth = 'tw-pricing-three';
  1066. break;
  1067. }
  1068. case'4': {
  1069. $columnWidth = 'tw-pricing-four';
  1070. break;
  1071. }
  1072. case'5': {
  1073. $columnWidth = 'tw-pricing-five';
  1074. break;
  1075. }
  1076. }
  1077. query_posts($query);
  1078. while (have_posts()) {
  1079. the_post();
  1080.  
  1081. $featured = get_metabox('featured') ? ' tw-featured' : '';
  1082. $color = get_metabox('color') != '' ? (' style="background:' . get_metabox('color') . '"') : '';
  1083. $output .= '<div class="' . $columnWidth . $featured . ' tw-pricing-col">';
  1084. $output .= '<div class="tw-pricing-box">';
  1085. $output .= '<div class="tw-pricing-header"' . $color . '>';
  1086. $output .= '<h1>' . get_the_title() . '</h1>';
  1087. // if(get_metabox('subtitle')!="") $output .= ('<p>'.get_metabox('subtitle').'</p>');
  1088. $output .= '</div>';
  1089. $output .= '<div class="tw-pricing-top">';
  1090. $output .= '<span>' . get_metabox('price') . '</span><span>' . get_metabox('time') . '</span>';
  1091. $output .= '</div>';
  1092. $output .= '<div class="tw-pricing-bottom">';
  1093. $output .= get_the_content();
  1094. $output .= '</div>';
  1095. if (get_metabox('buttontext') != "") {
  1096. $output .= '<div class="tw-pricing-footer">';
  1097. $output .= '<a href="' . (get_metabox('buttonlink') != "" ? get_metabox('buttonlink') : "#") . '" class="btn"' . $color . '>' . get_metabox('buttontext') . '</a>';
  1098. $output .= '</div>';
  1099. }
  1100. $output .= '</div>';
  1101. $output .= '</div>';
  1102. }
  1103. wp_reset_query();
  1104. $output .= '</div>';
  1105.  
  1106. return $output;
  1107. }
  1108.  
  1109. }
  1110. add_shortcode('tw_pricing_table', 'shortcode_tw_pricing_table');
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116. /* ================================================================================== */
  1117. /* Testimonials Shortcode
  1118. /* ================================================================================== */
  1119.  
  1120. if (!function_exists('shortcode_tw_testimonials')) {
  1121.  
  1122. function shortcode_tw_testimonials($atts, $content) {
  1123. $test_style = isset($atts['test_style']) ? $atts['test_style'] : '';
  1124. $direction = empty($atts['direction']) ? 'up' : $atts['direction'];
  1125. $duration = empty($atts['duration']) ? '1000' : $atts['duration'];
  1126. $timeout = empty($atts['timeout']) ? '2000' : $atts['timeout'];
  1127. $bg_color = empty($atts['bg_color']) ? '' : (' style="background:' . $atts['bg_color'] . '"');
  1128. $text_color = empty($atts['text_color']) ? '' : (' style="color:' . $atts['text_color'] . '"');
  1129. $name_color = empty($atts['name_color']) ? '' : (' style="color:' . $atts['name_color'] . '"');
  1130. $output = '<div class="tw-testimonials ' . $test_style . ' list_carousel" data-direction="' . $direction . '" data-duration="' . $duration . '" data-timeout="' . $timeout . '"><ul>';
  1131. $query = Array(
  1132. 'post_type' => 'tw_testimonial',
  1133. 'posts_per_page' => $atts['count'],
  1134. );
  1135. $cats = empty($atts['category_ids']) ? false : explode(",", $atts['category_ids']);
  1136. if ($cats) {
  1137. $query['tax_query'] = Array(Array(
  1138. 'taxonomy' => 'cat_testimonial',
  1139. 'terms' => $cats,
  1140. 'field' => 'slug'
  1141. )
  1142. );
  1143. }
  1144. query_posts($query);
  1145. while (have_posts()) {
  1146. the_post();
  1147. if ($test_style === 'style_1') {
  1148. $output .= '<li>';
  1149. $output .= '<div class="testimonial-item clearfix">';
  1150. $output .= '<div class="testimonial-content">';
  1151. $output .= get_the_content();
  1152. $output .= '</div>';
  1153. $output .= '</div>';
  1154. $output .= '<div class="testimonial-author">';
  1155. $output .= post_image_show(60, 60);
  1156. $output .= '</div>';
  1157. $output .= '<p class="testimonial-name">' . get_metabox('name') . '</p>';
  1158. $output .= '<a href="' . get_metabox('url') . '" class="company">' . get_metabox('company') . '</a>';
  1159. $output .= '</li>';
  1160. } else {
  1161. $output .= '<li>';
  1162. $output .= '<div class="testimonial-item clearfix"' . $bg_color . '>';
  1163. $output .= '<div class="testimonial-author">';
  1164. $output .= post_image_show(45, 45);
  1165. $output .= '</div>';
  1166. $output .= '<div class="testimonial-content"' . $text_color . '>';
  1167. $output .= get_the_content();
  1168. $output .= '</div>';
  1169. $output .= '</div>';
  1170. $output .= '<p class="testimonial-name"><a href="' . get_metabox('url') . '"' . $name_color . '>' . get_metabox('name') . '</a> / ' . get_metabox('company') . ' /</p>';
  1171. $output .= '</li>';
  1172. }
  1173. }
  1174. wp_reset_query();
  1175. $output .= '</ul>';
  1176. $output .= '<div class="carousel-arrow">';
  1177. $output .= '<a class="carousel-prev" href="#"><i class="fa fa-chevron-left"></i></a>';
  1178. $output .= '<a class="carousel-next" href="#"><i class="fa fa-chevron-right"></i></a>';
  1179. $output .= '</div>';
  1180. $output .= '</div>';
  1181.  
  1182. return $output;
  1183. }
  1184.  
  1185. }
  1186. add_shortcode('tw_testimonials', 'shortcode_tw_testimonials');
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192. /* ================================================================================== */
  1193. /* Team Shortcode
  1194. /* ================================================================================== */
  1195.  
  1196. if (!function_exists('shortcode_tw_team')) {
  1197.  
  1198. function shortcode_tw_team($atts, $content) {
  1199. $query = Array(
  1200. 'post_type' => 'tw_team',
  1201. 'posts_per_page' => $atts['count'],
  1202. );
  1203. $cats = empty($atts['category_ids']) ? false : explode(",", $atts['category_ids']);
  1204. if ($cats) {
  1205. $query['tax_query'] = Array(Array(
  1206. 'taxonomy' => 'cat_team',
  1207. 'terms' => $cats,
  1208. 'field' => 'slug'
  1209. )
  1210. );
  1211. }
  1212. $width = 270;
  1213. $height = $atts['height'];
  1214. $output = '<div class="tw-our-team">';
  1215. query_posts($query);
  1216. while (have_posts()) {
  1217. the_post();
  1218. $teamContent = do_shortcode(get_the_content());
  1219. $output .= '<div class="team-member">';
  1220. $output .= '<div class="team-ct">';
  1221. $output .= '<div class="member-image loop-image">';
  1222. $output .= post_image_show($width, $height);
  1223. $output .='<div class="image-overlay">';
  1224. if (get_metabox('facebook') != "" || get_metabox('google') != "" || get_metabox('twitter') != "" || get_metabox('linkedin') != "") {
  1225. $output .= '<div class="member-social">';
  1226. $output .= '<div class="tw-social-icon clearfix">';
  1227. if (get_metabox('facebook') != ""){
  1228. $output .= '<a href="' . esc_url(get_metabox('facebook')) . '" target="_blank" class="facebook"><span class="tw-icon-facebook"></span></a>';
  1229. }
  1230. if (get_metabox('google') != ""){
  1231. $output .= '<a href="' . esc_url(get_metabox('google')) . '" target="_blank" class="gplus"><span class="tw-icon-gplus"></span></a>';
  1232. }
  1233. if (get_metabox('twitter') != ""){
  1234. $output .= '<a href="' . esc_url(get_metabox('twitter')) . '" target="_blank" class="twitter"><span class="tw-icon-twitter"></span></a>';
  1235. }
  1236. if (get_metabox('linkedin') != ""){
  1237. $output .= '<a href="' . esc_url(get_metabox('linkedin')) . '" target="_blank" class="linkedin"><span class="tw-icon-linkedin"></span></a>';
  1238. }
  1239. $output .= '</div>';
  1240. $output .= '</div>';
  1241. }
  1242. $output .='</div>';
  1243. $output .='</div>';
  1244. $output .= '<div class="member-title">';
  1245. $output .= '<h2>' . get_the_title() . '</h2>';
  1246. if (get_metabox('position') != ""){
  1247. $output .= '<span>' . get_metabox('position') . '</span>';
  1248. }
  1249. $output .= '</div>';
  1250. if (!empty($teamContent)) {
  1251. $output .= '<div class="team-content">';
  1252. $output .= $teamContent;
  1253. $output .= '</div>';
  1254. }
  1255. if (get_metabox('email') != ""){
  1256. $output .= '<div class="member-email"><i class="fa fa-envelope-o"></i>&nbsp;<a href="mailto:' . get_metabox('email') . '" title="' . get_metabox('email') . '">' . get_metabox('email') . '</a></div>';
  1257. }
  1258. $output .= '</div>';
  1259. $output .= '</div>';
  1260. }
  1261. wp_reset_query();
  1262. $output .= '</div>';
  1263.  
  1264. return $output;
  1265. }
  1266.  
  1267. }
  1268. add_shortcode('tw_team', 'shortcode_tw_team');
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274. /* ================================================================================== */
  1275. /* Twitter Shortcode
  1276. /* ================================================================================== */
  1277.  
  1278. function twitter_build($atts) {
  1279. require_once (THEME_PATH . "/framework/twitteroauth.php");
  1280. $atts = shortcode_atts(array(
  1281. 'consumerkey' => tw_option('consumerkey'),
  1282. 'consumersecret' => tw_option('consumersecret'),
  1283. 'accesstoken' => tw_option('accesstoken'),
  1284. 'accesstokensecret' => tw_option('accesstokensecret'),
  1285. 'cachetime' => '1',
  1286. 'username' => 'medusa',
  1287. 'tweetstoshow' => '10',
  1288. ), $atts);
  1289. //check settings and die if not set
  1290. if (empty($atts['consumerkey']) || empty($atts['consumersecret']) || empty($atts['accesstoken']) || empty($atts['accesstokensecret']) || !isset($atts['cachetime']) || empty($atts['username'])) {
  1291. return __('<p>Due to Twitter API changed you must insert Twitter APP. Check Our theme Options there you have Option for FB Twitter API, insert the Keys One Time</p>', 'medusa');
  1292. }
  1293. //check if cache needs update
  1294. $tw_twitter_last_cache_time = get_option('tw_twitter_last_cache_time_' . $atts['username']);
  1295. $diff = time() - $tw_twitter_last_cache_time;
  1296. $crt = $atts['cachetime'] * 3600;
  1297.  
  1298. //yes, it needs update
  1299. if ($diff >= $crt || empty($tw_twitter_last_cache_time)) {
  1300. $connection = new TwitterOAuth($atts['consumerkey'], $atts['consumersecret'], $atts['accesstoken'], $atts['accesstokensecret']);
  1301. $tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=" . $atts['username'] . "&count=10") or die('Couldn\'t retrieve tweets! Wrong username?');
  1302. if (!empty($tweets->errors)) {
  1303. if ($tweets->errors[0]->message == 'Invalid or expired token') {
  1304. return '<strong>' . $tweets->errors[0]->message . '!</strong><br />' . __('You\'ll need to regenerate it <a href=\'https://dev.twitter.com/apps\' target="_blank">here</a>!', 'medusa');
  1305. } else {
  1306. return '<strong>' . $tweets->errors[0]->message . '</strong>';
  1307. }
  1308. return;
  1309. }
  1310. $tweets_array = array();
  1311. for ($i = 0; is_array($tweets) && $i <= count($tweets); $i++) {
  1312. if (!empty($tweets[$i])) {
  1313. $tweets_array[$i]['created_at'] = $tweets[$i]->created_at;
  1314. $tweets_array[$i]['text'] = $tweets[$i]->text;
  1315. $tweets_array[$i]['status_id'] = $tweets[$i]->id_str;
  1316. }
  1317. }
  1318. //save tweets to wp option
  1319. update_option('tw_twitter_tweets_' . $atts['username'], rawUrlEncode(serialize($tweets_array)));
  1320. update_option('tw_twitter_last_cache_time_' . $atts['username'], time());
  1321. echo '<!-- twitter cache has been updated! -->';
  1322. }
  1323. //convert links to clickable format
  1324. if (!function_exists('convert_links')) {
  1325.  
  1326. function convert_links($status, $targetBlank = true, $linkMaxLen = 250) {
  1327. // the target
  1328. $target = $targetBlank ? " target=\"_blank\" " : "";
  1329. // convert link to url
  1330.  
  1331. $status = preg_replace_callback(
  1332. "/((http:\/\/|https:\/\/)[^ )]+)/",
  1333. function($m) use ($target, $linkMaxLen){
  1334. return '<a href="'. $m[1] .'" title="'. $m[1] .'" '. $target .'> '. ((strlen( $m[1] ) >= $linkMaxLen ? substr($m[1],0,$linkMaxLen) . '...' : $m[1] )) . '</a>';
  1335. },
  1336. $status
  1337. );
  1338. // convert @ to follow
  1339. $status = preg_replace("/(@([_a-z0-9\-]+))/i", "<a href=\"http://twitter.com/$2\" title=\"Follow $2\" $target >$1</a>", $status);
  1340. // convert # to search
  1341. $status = preg_replace("/(#([_a-z0-9\-]+))/i", "<a href=\"https://twitter.com/search?q=$2\" title=\"Search $1\" $target >$1</a>", $status);
  1342. // return the status
  1343. return $status;
  1344. }
  1345.  
  1346. }
  1347. //convert dates to readable format
  1348. if (!function_exists('relative_time')) {
  1349.  
  1350. function relative_time($a) {
  1351. //get current timestampt
  1352. $b = strtotime("now");
  1353. //get timestamp when tweet created
  1354. $c = strtotime($a);
  1355. //get difference
  1356. $d = $b - $c;
  1357. //calculate different time values
  1358. $minute = 60;
  1359. $hour = $minute * 60;
  1360. $day = $hour * 24;
  1361. $week = $day * 7;
  1362. if (is_numeric($d) && $d > 0) {
  1363. //if less then 3 seconds
  1364. if ($d < 3)
  1365. return __("right now", 'medusa');
  1366. //if less then minute
  1367. if ($d < $minute)
  1368. return floor($d) . __(" seconds ago", "medusa");
  1369. //if less then 2 minutes
  1370. if ($d < $minute * 2)
  1371. return __("about 1 minute ago", "medusa");
  1372. //if less then hour
  1373. if ($d < $hour)
  1374. return floor($d / $minute) . __(" minutes ago", "medusa");
  1375. //if less then 2 hours
  1376. if ($d < $hour * 2)
  1377. return __("about 1 hour ago", "medusa");
  1378. //if less then day
  1379. if ($d < $day)
  1380. return floor($d / $hour) . __(" hours ago", "medusa");
  1381. //if more then day, but less then 2 days
  1382. if ($d > $day && $d < $day * 2)
  1383. return __("yesterday", "medusa");
  1384. //if less then year
  1385. if ($d < $day * 365)
  1386. return floor($d / $day) . __(" days ago", "medusa");
  1387. //else return more than a year
  1388. return __("over a year ago", "medusa");
  1389. }
  1390. }
  1391.  
  1392. }
  1393. $tw_twitter_tweets = maybe_unserialize(rawUrlDecode(get_option('tw_twitter_tweets_' . $atts['username'])));
  1394. return $tw_twitter_tweets;
  1395. }
  1396.  
  1397. if (!function_exists('shortcode_tw_twitter')) {
  1398.  
  1399. function shortcode_tw_twitter($atts, $content) {
  1400. $tw_twitter_tweets = twitter_build($atts);
  1401. if (is_array($tw_twitter_tweets)) {
  1402. $output = '<div class="tw-twitter">';
  1403. $output.='<ul class="jtwt">';
  1404. $fctr = '1';
  1405. foreach ($tw_twitter_tweets as $tweet) {
  1406. $output.='<li><span>' . convert_links($tweet['text']) . '</span><br /><a class="twitter_time" target="_blank" href="http://twitter.com/' . $atts['username'] . '/statuses/' . $tweet['status_id'] . '">' . relative_time($tweet['created_at']) . '</a></li>';
  1407. if ($fctr == $atts['tweetstoshow']) {
  1408. break;
  1409. }
  1410. $fctr++;
  1411. }
  1412. $output.='</ul>';
  1413. $output.='<div class="twitter-follow">' . (tw_option('tw_car_follow') ? tw_option('tw_car_follow') : __('Follow Us', 'medusa')) . ' - <a target="_blank" href="http://twitter.com/' . $atts['username'] . '">@' . $atts['username'] . '</a></div>';
  1414. $output.='</div>';
  1415. return $output;
  1416. } else {
  1417. return $tw_twitter_tweets;
  1418. }
  1419. }
  1420.  
  1421. }
  1422. add_shortcode('tw_twitter', 'shortcode_tw_twitter');
  1423.  
  1424.  
  1425.  
  1426. if (!function_exists('shortcode_tw_twitter_carousel')) {
  1427.  
  1428. function shortcode_tw_twitter_carousel($atts, $content) {
  1429. $tw_twitter_tweets = twitter_build($atts);
  1430. if (is_array($tw_twitter_tweets)) {
  1431. $layout = !empty($atts['layout']) ? 'style2' : '';
  1432. $layoutclass = '';
  1433. $br = '<br />';
  1434. $follow_txt = tw_option('tw_car_follow') ? tw_option('tw_car_follow') : __('Follow Us', 'medusa');
  1435. $icon = '<i class="fa fa-twitter"></i>';
  1436. if ($layout == 'style2') {
  1437. $layoutclass = ' style2';
  1438. $br = '';
  1439. $icon = '<i class="fa fa-twitter"><span class="twitter-follow">' . __('Twitter updates: ', 'medusa') . '</span></i>';
  1440. }
  1441. $arrow = '<div class="carousel-arrow tw-carrow">';
  1442. $arrow .= '<a class="carousel-prev" href="#"><i class="fa fa-chevron-left"></i></a>';
  1443. $arrow .= '<a class="carousel-next" href="#"><i class="fa fa-chevron-right"></i></a>';
  1444. $arrow .= '</div>';
  1445. $output = '<div class="tw-twitter">';
  1446. $output .= '<div class="carousel-container">';
  1447. $output .= '<div class="tw-carousel-twitter list_carousel' . $layoutclass . '">';
  1448. $output .= $icon;
  1449. $output.='<ul class="jtwt tw-carousel">';
  1450. $fctr = '1';
  1451. foreach ($tw_twitter_tweets as $tweet) {
  1452. if ($layout == 'style2') {
  1453. $twittrname = '<a target="_blank" href="http://twitter.com/' . $atts['username'] . '">@' . $atts['username'] . '</a>';
  1454. $output.='<li><span>' . convert_links($tweet['text']) . '</span>' . $br . ' - <a class="twitter_time" target="_blank" href="http://twitter.com/' . $atts['username'] . '/statuses/' . $tweet['status_id'] . '">' . relative_time($tweet['created_at']) . '</a> - ' . $twittrname . '</li>';
  1455. } else {
  1456. $output.='<li><span>' . convert_links($tweet['text']) . '</span>' . $br . '- <a class="twitter_time" target="_blank" href="http://twitter.com/' . $atts['username'] . '/statuses/' . $tweet['status_id'] . '">' . relative_time($tweet['created_at']) . '</a></li>';
  1457. }
  1458.  
  1459. if ($fctr == $atts['tweetstoshow']) {
  1460. break;
  1461. }
  1462. $fctr++;
  1463. }
  1464. $output.='</ul>';
  1465. if ($layout != 'style2') {
  1466. $output .='<div class="twitter-follow">' . $follow_txt . ' - <a target="_blank" href="http://twitter.com/' . $atts['username'] . '">@' . $atts['username'] . '</a></div>';
  1467. }
  1468. $output .= $arrow;
  1469. $output.='</div>';
  1470. $output.='</div>';
  1471. $output.='</div>';
  1472. return $output;
  1473. } else {
  1474. return $tw_twitter_tweets;
  1475. }
  1476. }
  1477.  
  1478. }
  1479. add_shortcode('tw_twitter_carousel', 'shortcode_tw_twitter_carousel');
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485. /* ================================================================================== */
  1486. /* Portfolio Shortcode
  1487. /* ================================================================================== */
  1488.  
  1489. if (!function_exists('shortcode_tw_portfolio')) {
  1490.  
  1491. function shortcode_tw_portfolio($atts, $content) {
  1492. $atts = shortcode_atts(array(
  1493. 'layout_size' => 'span12',
  1494. 'layout_type' => 'classic',
  1495. 'pagination' => 'simple',
  1496. 'count' => 12,
  1497. 'filter' => 'none',
  1498. 'category_ids' => '',
  1499. 'not_in' => '',
  1500. 'hide_hover' => 'false',
  1501. 'port_height' => '250',
  1502. 'port_column_count' => '2',
  1503. 'column' => '4',
  1504. 'order' => ''
  1505. ), $atts);
  1506. if (empty($atts['port_height'])) {
  1507. $atts['port_height'] = '250';
  1508. }
  1509. global $portAtts, $paged, $tw_options;
  1510. $portAtts = $atts;
  1511.  
  1512. if ($atts['layout_size'] === 'span3') {
  1513. $tw_options['column'] = '1';
  1514. } elseif ($atts['layout_size'] === 'span9') {
  1515. $tw_options['column'] = '3';
  1516. } elseif ($atts['layout_size'] === 'span12') {
  1517. switch ($atts['column']) {
  1518. case '2': {
  1519. $tw_options['column'] = '6';
  1520. break;
  1521. }
  1522. case '3': {
  1523. $tw_options['column'] = '4';
  1524. break;
  1525. }
  1526. case '4': {
  1527. $tw_options['column'] = '3';
  1528. break;
  1529. }
  1530. }
  1531. }
  1532.  
  1533. if (get_query_var('paged'))
  1534. $my_page = get_query_var('paged');
  1535. else {
  1536. if (get_query_var('page'))
  1537. $my_page = get_query_var('page');
  1538. else
  1539. $my_page = 1;
  1540. set_query_var('paged', $my_page);
  1541. }
  1542. add_action('wp_footer', 'isotope_script');
  1543. $tw_options['pagination'] = $atts['pagination'];
  1544. $query = Array(
  1545. 'post_type' => 'tw_portfolio',
  1546. 'posts_per_page' => $atts['count'],
  1547. );
  1548. if(!empty($atts['not_in'])) {
  1549. $query['post__not_in'] = array($atts['not_in']);
  1550. }
  1551. if ($tw_options['pagination'] == "simple" || $tw_options['pagination'] == "infinite") {
  1552. $query['paged'] = $my_page;
  1553. }
  1554. $cats = empty($atts['category_ids']) ? false : explode(",", $atts['category_ids']);
  1555. if ($cats) {
  1556. $query['tax_query'] = Array(Array(
  1557. 'taxonomy' => 'cat_portfolio',
  1558. 'terms' => $cats,
  1559. 'field' => 'slug'
  1560. )
  1561. );
  1562. }
  1563. if (!empty($atts['order'])) {
  1564. switch ($atts['order']) {
  1565. case "date_asc":
  1566. $query['orderby'] = 'date';
  1567. $query['order'] = 'ASC';
  1568. break;
  1569. case "title_asc":
  1570. $query['orderby'] = 'title';
  1571. $query['order'] = 'ASC';
  1572. break;
  1573. case "title_desc":
  1574. $query['orderby'] = 'title';
  1575. $query['order'] = 'DESC';
  1576. break;
  1577. case "random":
  1578. $query['orderby'] = 'rand';
  1579. break;
  1580. }
  1581. }
  1582. $output = '<div class="tw-portfolio">';
  1583. $filter = (!empty($atts['filter']) && $atts['filter'] == 'true') ? true : false;
  1584. if ($filter) {
  1585. $output .= '<div class="tw-filter">';
  1586. $output .= '<ul class="filters option-set clearfix post-category inline" data-option-key="filter">';
  1587. $output .= '<li><a href="#filter" data-option-value="*" class="selected">' . (tw_option('portfolio_show_all') ? tw_option('portfolio_show_all') : __('Show All', 'medusa')) . '</a></li>';
  1588. if ($cats) {
  1589. $filters = $cats;
  1590. } else {
  1591. $filters = get_terms('cat_portfolio');
  1592. }
  1593. foreach ($filters as $category) {
  1594. if ($cats) {
  1595. $category = get_term_by('slug', $category, 'cat_portfolio');
  1596. }
  1597. $output .= '<li class="hidden"><a href="#filter" data-option-value=".category-' . $category->slug . '" title="' . $category->name . '">' . $category->name . '</a></li>';
  1598. }
  1599. $output .= '</ul></div>';
  1600. }
  1601. if (!is_tax())
  1602. query_posts($query);
  1603. ob_start();
  1604. get_template_part("loop", "portfolio");
  1605. $output .= ob_get_clean();
  1606. wp_reset_query();
  1607. $output .= '</div>';
  1608.  
  1609. unset($portAtts);
  1610. return $output;
  1611. }
  1612.  
  1613. }
  1614.  
  1615. function isotope_script() {
  1616. wp_enqueue_script('isotope', THEME_DIR . '/assets/js/jquery.isotope.min.js', false, false, true);
  1617. ?>
  1618. <?php
  1619. }
  1620.  
  1621. add_shortcode('tw_portfolio', 'shortcode_tw_portfolio');
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634. /* ================================================================================== */
  1635. /* Recent Posts Shortcode
  1636. /* ================================================================================== */
  1637.  
  1638. if (!function_exists('shortcode_tw_recent_posts')) {
  1639.  
  1640. function shortcode_tw_recent_posts($atts, $content) {
  1641. global $post;
  1642. $post_count = isset($atts['post_count']) ? $atts['post_count'] : '';
  1643. $layout = isset($atts['layout']) ? $atts['layout'] : '';
  1644. $post_category_list = isset($atts['post_category_list']) ? $atts['post_category_list'] : '';
  1645. $arrow = '<div class="carousel-arrow tw-carrow">';
  1646. $arrow .= '<a class="carousel-prev" href="#"><i class="fa fa-chevron-left"></i></a>';
  1647. $arrow .= '<a class="carousel-next" href="#"><i class="fa fa-chevron-right"></i></a>';
  1648. $arrow .= '</div>';
  1649.  
  1650. $output = '';
  1651. $output .= '<div class="carousel-container">';
  1652. $output .= '<div class="tw-carousel-post list_carousel ' . $layout . '">';
  1653. $output .= '<ul class="tw-carousel">';
  1654. $query = Array(
  1655. 'post_type' => 'post',
  1656. 'posts_per_page' => $post_count,
  1657. );
  1658. $cats = explode(",", $post_category_list);
  1659. if (!empty($cats[0])) {
  1660. $query['tax_query'] = Array(Array(
  1661. 'taxonomy' => 'category',
  1662. 'terms' => $cats,
  1663. 'field' => 'slug'
  1664. )
  1665. );
  1666. }
  1667. if (!empty($atts['order'])) {
  1668. switch ($atts['order']) {
  1669. case "date_asc":
  1670. $query['orderby'] = 'date';
  1671. $query['order'] = 'ASC';
  1672. break;
  1673. case "title_asc":
  1674. $query['orderby'] = 'title';
  1675. $query['order'] = 'ASC';
  1676. break;
  1677. case "title_desc":
  1678. $query['orderby'] = 'title';
  1679. $query['order'] = 'DESC';
  1680. break;
  1681. case "random":
  1682. $query['orderby'] = 'rand';
  1683. break;
  1684. }
  1685. }
  1686. $imgwidth = 370;
  1687. // START - LOOP
  1688. query_posts($query);
  1689. while (have_posts()) {
  1690. the_post();
  1691. $imgheight = !empty($atts['image_height']) ? $atts['image_height'] : '';
  1692. $excerpt = isset($atts['excerpt_count']) ? $atts['excerpt_count'] : 20;
  1693. $post_format = get_post_format();
  1694. $post_title = true;
  1695. $post_content = '<h3><a href="' . get_permalink() . '" class="carousel-post-title">' . get_the_title() . '</a></h3>';
  1696. $post_content .= '<div class="carousel-meta clearfix"><div class="date">' . get_the_time('j M Y') . '</div> / <div class="comment-count">' . comment_count() . '</div></div>';
  1697. $output .= '<li>';
  1698. $output .= '<div class="carousel-content">';
  1699. if (post_image_show()) {
  1700. ob_start();
  1701. $hover_contet = $atts['layout'] == 'style2' ? true : false;
  1702. carousel_post_image($imgwidth, $imgheight, $hover_contet, $excerpt);
  1703. $output .= ob_get_clean();
  1704. $post_title = false;
  1705. } elseif ($post_format == 'gallery') {
  1706. $ids = get_post_meta($post->ID, 'gallery_image_ids', true);
  1707. ob_start();
  1708. portfolio_gallery($imgwidth, $imgheight, $ids);
  1709. $output .= ob_get_clean();
  1710. } elseif ($post_format == 'video') {
  1711. $output .= '<div class="carousel-video" style="height:' . $imgheight . 'px;">';
  1712. ob_start();
  1713. format_video();
  1714. $output .= ob_get_clean();
  1715. $output .= '</div>';
  1716. }
  1717. if ($atts['layout'] != 'style2' || $post_title) {
  1718. $output .= $post_content;
  1719. }
  1720. $output .= '</div>';
  1721. $output .= '</li>';
  1722. }
  1723. wp_reset_query();
  1724. // END - LOOP
  1725. $output .= '</ul>';
  1726. $output .= '<div class="clearfix"></div>';
  1727. $output .= $arrow;
  1728. $output .= '</div>';
  1729. $output .= '</div>';
  1730. return $output;
  1731. }
  1732.  
  1733. }
  1734. add_shortcode('tw_recent_posts', 'shortcode_tw_recent_posts');
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744. /* ================================================================================== */
  1745. /* Recent Portfolios Shortcode
  1746. /* ================================================================================== */
  1747.  
  1748. if (!function_exists('shortcode_tw_recent_portfolios')) {
  1749.  
  1750. function shortcode_tw_recent_portfolios($atts, $content) {
  1751. $post_count = isset($atts['post_count']) ? $atts['post_count'] : '';
  1752. $desc_title = !empty($atts['description_title']) ? $atts['description_title'] : '';
  1753. $desc_text = !empty($atts['description_text']) ? $atts['description_text'] : '';
  1754. $desc_link = !empty($atts['description_link']) ? $atts['description_link'] : '';
  1755. $port_category_list = isset($atts['port_category_list']) ? $atts['port_category_list'] : '';
  1756. $prettyphoto = !empty($atts['hide_hover']) ? $atts['hide_hover'] : 'true';
  1757. $pager = isset($atts['pager']) ? $atts['pager'] : 'arrow';
  1758. $arrow = '<div class="carousel-arrow tw-carrow">';
  1759. $arrow .= '<a class="carousel-prev" href="#"><i class="fa fa-chevron-left"></i></a>';
  1760. if (!empty($desc_text) && !empty($desc_link)) {
  1761. $arrow .= '<a href="' . $desc_link . '"><i class="fa fa-th"></i></a>';
  1762. }
  1763. $arrow .= '<a class="carousel-next" href="#"><i class="fa fa-chevron-right"></i></a>';
  1764. $arrow .= '</div>';
  1765. $output = '';
  1766. if (!empty($desc_text)) {
  1767. $output .= '<div class="row-fluid carousel-container">';
  1768. $output .= '<div class="span3 carousel-text tw-title-container">';
  1769. $output .=!empty($desc_title) ? ('<div class="tw-title-container"><h3 class="tw-title">' . $desc_title . '</h3><span class="tw-title-border"></span></div>') : '';
  1770. $output .= '<p>' . $desc_text . '</p>';
  1771. $output .= '<div class="portfolio-post-link">' . $arrow . '</div></div>';
  1772. $output .= '<div class="span9">';
  1773. } else {
  1774. $output .= '<div class="carousel-container">';
  1775. }
  1776.  
  1777.  
  1778. $output .= '<div class="tw-carousel-portfolio list_carousel">';
  1779. $output .= '<ul class="tw-carousel">';
  1780. $query = Array(
  1781. 'post_type' => 'tw_portfolio',
  1782. 'posts_per_page' => $post_count,
  1783. );
  1784. $cats = explode(",", $port_category_list);
  1785. if (!empty($cats[0])) {
  1786. $query['tax_query'] = Array(Array(
  1787. 'taxonomy' => 'cat_portfolio',
  1788. 'terms' => $cats,
  1789. 'field' => 'slug'
  1790. )
  1791. );
  1792. }
  1793. if (!empty($atts['order'])) {
  1794. switch ($atts['order']) {
  1795. case "date_asc":
  1796. $query['orderby'] = 'date';
  1797. $query['order'] = 'ASC';
  1798. break;
  1799. case "title_asc":
  1800. $query['orderby'] = 'title';
  1801. $query['order'] = 'ASC';
  1802. break;
  1803. case "title_desc":
  1804. $query['orderby'] = 'title';
  1805. $query['order'] = 'DESC';
  1806. break;
  1807. case "random":
  1808. $query['orderby'] = 'rand';
  1809. break;
  1810. }
  1811. }
  1812. $imgwidth = 270;
  1813. // START - LOOP
  1814. query_posts($query);
  1815. while (have_posts()) {
  1816. the_post();
  1817. global $post;
  1818. $imgheight = $atts['image_height'];
  1819. $output .= '<li>';
  1820. $ids = get_metabox('gallery_image_ids');
  1821. $video_embed = get_metabox('format_video_embed');
  1822. $video_url = get_metabox('pretty_video_url');
  1823. $featuredimage = false;
  1824. ob_start();
  1825. if (has_post_thumbnail($post->ID)) {
  1826. if (!empty($video_url) && get_metabox('pretty_video') === 'true') {
  1827. $featuredimage = true;
  1828. } else {
  1829. $featuredimage = true;
  1830. }
  1831. } elseif ($ids != "false" && $ids != "") {
  1832. portfolio_gallery($imgwidth, $imgheight, $ids);
  1833. } elseif (!empty($video_embed)) {
  1834. echo '<div class="carousel-video">';
  1835. echo apply_filters("the_content", htmlspecialchars_decode($video_embed));
  1836. echo '</div>';
  1837. }
  1838.  
  1839. $content = '<div class="portfolio-content">';
  1840. $content .= '<h2 class="portfolio-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
  1841. $content .= get_the_term_list($post->ID, 'cat_portfolio', '<div class="meta-cat">', ' / ', '</div>');
  1842. $content .= '</div>';
  1843.  
  1844. if ($featuredimage) {
  1845. $portURL = post_image_show(0, 0, true);
  1846. ?>
  1847. <div class="loop-image"><?php
  1848. echo post_image_show($imgwidth, $imgheight);
  1849. echo $content;
  1850. if ($prettyphoto == 'true') {
  1851. ?>
  1852. <div class="image-overlay portfolio-carousel">
  1853. <div class="car-por-container">
  1854. <div class="image-links">
  1855. <a href="<?php echo $portURL; ?>" rel="prettyPhoto[<?php echo $post->ID; ?>]"><i class="fa fa-plus-square"></i></a>
  1856. <a href="<?php the_permalink(); ?>"><i class="fa fa-external-link"></i></a>
  1857. </div>
  1858. <h2 class="portfolio-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
  1859. </div>
  1860. </div><?php }
  1861. ?>
  1862. </div><?php
  1863. } else {
  1864. echo $content;
  1865. }
  1866.  
  1867. $output .= ob_get_clean();
  1868.  
  1869. $output .= '</li>';
  1870. }
  1871. wp_reset_query();
  1872. // END - LOOP
  1873. $output .= '</ul>';
  1874. $output .= '<div class="clearfix"></div>';
  1875.  
  1876. if (empty($desc_text)) {
  1877. if ($pager == 'bullet')
  1878. $output .= '<div class="carousel-bullet"></div>';
  1879. else
  1880. $output .= $arrow;
  1881. }
  1882. $output .= '</div>';
  1883. if (!empty($desc_text)) {
  1884. $output .= '</div>';
  1885. }
  1886. $output .= '</div>';
  1887. unset($portAtts);
  1888. return $output;
  1889. }
  1890.  
  1891. }
  1892. add_shortcode('tw_recent_portfolios', 'shortcode_tw_recent_portfolios');
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902. /* ================================================================================== */
  1903. /* Partner Shortcode
  1904. /* ================================================================================== */
  1905.  
  1906. if (!function_exists('shortcode_tw_partner')) {
  1907.  
  1908. function shortcode_tw_partner($atts, $content) {
  1909. $category_list = isset($atts['partner_category_list']) ? $atts['partner_category_list'] : '';
  1910. $arrow = '<div class="carousel-arrow tw-carrow">';
  1911. $arrow .= '<a class="carousel-prev" href="#"><i class="fa fa-chevron-left"></i></a>';
  1912. $arrow .= '<a class="carousel-next" href="#"><i class="fa fa-chevron-right"></i></a>';
  1913. $arrow .= '</div>';
  1914.  
  1915. $output = '';
  1916. $output .= '<div class="carousel-container">';
  1917.  
  1918. $output .= '<div class="tw-carousel-partner list_carousel">';
  1919. $output .= '<ul class="tw-carousel">';
  1920. $query = Array(
  1921. 'post_type' => 'tw_partner',
  1922. 'posts_per_page' => -1,
  1923. );
  1924. $cats = explode(",", $category_list);
  1925. $imgwidth = 270;
  1926. if (!empty($cats[0])) {
  1927. $query['tax_query'] = Array(Array(
  1928. 'taxonomy' => 'cat_partner',
  1929. 'terms' => $cats,
  1930. 'field' => 'slug'
  1931. )
  1932. );
  1933. }
  1934. if (!empty($atts['order'])) {
  1935. switch ($atts['order']) {
  1936. case "date_asc":
  1937. $query['orderby'] = 'date';
  1938. $query['order'] = 'ASC';
  1939. break;
  1940. case "title_asc":
  1941. $query['orderby'] = 'title';
  1942. $query['order'] = 'ASC';
  1943. break;
  1944. case "title_desc":
  1945. $query['orderby'] = 'title';
  1946. $query['order'] = 'DESC';
  1947. break;
  1948. case "random":
  1949. $query['orderby'] = 'rand';
  1950. break;
  1951. }
  1952. }
  1953. // START - LOOP
  1954. query_posts($query);
  1955. while (have_posts()) {
  1956. the_post();
  1957. $imgheight = $atts['image_height'];
  1958. $output .= '<li>';
  1959. if (get_metabox('link') != '') {
  1960. $output .= '<a href="' . esc_url(get_metabox('link')) . '" target="_blank">';
  1961. $output .= post_image_show($imgwidth, $imgheight);
  1962. $output .= '</a>';
  1963. } else {
  1964. $output .= post_image_show($imgwidth, $imgheight);
  1965. }
  1966. $output .= '</li>';
  1967. }
  1968. wp_reset_query();
  1969. // END - LOOP
  1970. $output .= '</ul>';
  1971. $output .= '<div class="clearfix"></div>';
  1972. $output .= $arrow;
  1973. $output .= '</div>';
  1974. $output .= '</div>';
  1975. return $output;
  1976. }
  1977.  
  1978. }
  1979. add_shortcode('tw_partner', 'shortcode_tw_partner');
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988. /* ================================================================================== */
  1989. /* Dropcap Shortcode
  1990. /* ================================================================================== */
  1991.  
  1992. if (!function_exists('shortcode_tw_dropcap')) {
  1993.  
  1994. function shortcode_tw_dropcap($atts, $content) {
  1995. $class = '';
  1996. $style = 'style="background-color: ' . $atts['color'] . ';"';
  1997. if ($atts['style'] == 'circle') {
  1998. $class = ' cap_circle';
  1999. } elseif ($atts['style'] == 'circle_border') {
  2000. $class = ' cap_circle cap_border';
  2001. $style = 'style="border-color: ' . $atts['color'] . '; color: ' . $atts['color'] . '"';
  2002. } elseif ($atts['style'] == 'square_border') {
  2003. $class = ' cap_border';
  2004. $style = 'style="border-color: ' . $atts['color'] . '; color: ' . $atts['color'] . '"';
  2005. }
  2006. return '<span class="tw-dropcap' . $class . '" ' . $style . '>' . $content . '</span>';
  2007. }
  2008.  
  2009. }
  2010. add_shortcode('tw_dropcap', 'shortcode_tw_dropcap');
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016. /* ================================================================================== */
  2017. /* Button Shortcode
  2018. /* ================================================================================== */
  2019.  
  2020. if (!function_exists('shortcode_tw_button')) {
  2021.  
  2022. function shortcode_tw_button($atts, $content) {
  2023. $icon='';
  2024. if (!empty($atts['icon'])) {
  2025. $icon = '<i class="' . $atts['icon'] . '"></i>';
  2026. }
  2027. $rounded = !empty($atts['rounded']) && $atts['rounded'] == 'true' ? ' rounded' : '';
  2028. $link = !empty($atts['link']) ? $atts['link'] : '#';
  2029. $style = !empty($atts['style']) ? (' btn-' . $atts['style']) : '';
  2030. $hover = !empty($atts['hover']) ? (' btn-' . $atts['hover']) : '';
  2031. $size = !empty($atts['size']) ? (' btn-' . $atts['size']) : '';
  2032. $target = !empty($atts['target']) ? ($atts['target']) : '_blank';
  2033. $whitecolor = '';
  2034. $color = '';
  2035. if (!empty($atts['color'])) {
  2036. $color = ' style="border-color:' . $atts['color'] . ';';
  2037. $color .= (!empty($atts['style']) && $atts['style'] === 'border' ? ('color:' . $atts['color']) : ('background-color:' . $atts['color'])) . '"';
  2038. if ($atts['color']=='#fff'||$atts['color']=='#ffffff'||$atts['color']=='white')
  2039. $whitecolor = ' white-button';
  2040. }
  2041. return '<a href="' . $link . '" target="' . $target . '" class="btn' . $rounded . $style . $size . $hover . $whitecolor . '"' . $color . '>' . $icon . $content . '<span></span></a>';
  2042. }
  2043.  
  2044. }
  2045. add_shortcode('tw_button', 'shortcode_tw_button');
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051. /* ================================================================================== */
  2052. /* Label Shortcode
  2053. /* ================================================================================== */
  2054.  
  2055. if (!function_exists('shortcode_tw_label')) {
  2056.  
  2057. function shortcode_tw_label($atts, $content) {
  2058. $color = !empty($atts['color']) ? (' style="background:' . $atts['color'] . '"') : '';
  2059. return '<span class="label"' . $color . '>' . $content . '</span>';
  2060. }
  2061.  
  2062. }
  2063. add_shortcode('tw_label', 'shortcode_tw_label');
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069. /* ================================================================================== */
  2070. /* Social Icon Shortcode
  2071. /* ================================================================================== */
  2072.  
  2073. if (!function_exists('shortcode_tw_social_icons')) {
  2074. function shortcode_tw_social_icons($atts, $content) {
  2075. return '<div class="tw-social-icon">'.tw_get_socials($atts).'</div>';
  2076. }
  2077. }
  2078. add_shortcode('tw_social_icons', 'shortcode_tw_social_icons');
  2079.  
  2080.  
  2081.  
  2082.  
  2083. /* ================================================================================== */
  2084. /* ColumnShortcode Shortcode
  2085. /* ================================================================================== */
  2086.  
  2087. // ColumnShortcode container
  2088. if (!function_exists('shortcode_tw_sh_column')) {
  2089.  
  2090. function shortcode_tw_sh_column($atts, $content) {
  2091. $output = '<div class="tw-column-shortcode row-fluid">';
  2092. $output .= do_shortcode($content);
  2093. $output .= '</div>';
  2094. return $output;
  2095. }
  2096.  
  2097. }
  2098. add_shortcode('tw_sh_column', 'shortcode_tw_sh_column');
  2099. // ColumnShortcode Item
  2100. if (!function_exists('shortcode_tw_sh_column_item')) {
  2101.  
  2102. function shortcode_tw_sh_column_item($atts, $content) {
  2103. extract(shortcode_atts(array(
  2104. 'column_size' => '1 / 3',
  2105. 'item_animation' => 'none',
  2106. 'item_animation_offset' => 'bottom-in-view',
  2107. ), $atts));
  2108. if (isMobile() && !tw_option('moblile_animation')) {
  2109. $atts['item_animation'] = 'none';
  2110. }
  2111. $class = '';
  2112. $animated = false;
  2113. if (isset($atts['item_animation']) && $atts['item_animation'] !== 'none') {
  2114. $animated = true;
  2115. $class .= ' tw-animate-gen';
  2116. $atts['item_animation_offset'] = isset($atts['item_animation_offset']) ? str_replace(' ', '', $atts['item_animation_offset']) : '';
  2117. $atts['item_animation_offset'] = empty($atts['item_animation_offset']) ? 'bottom-in-view' : $atts['item_animation_offset'];
  2118. }
  2119. $output = '<div class="' . pbTextToFoundation($column_size) . ' ' . $class . '"' . ($animated ? ' data-gen="' . $atts['item_animation'] . '" data-gen-offset="' . $atts['item_animation_offset'] . '" style="opacity:0;"' : '') . '>';
  2120. $output .= do_shortcode($content);
  2121. $output .= '</div>';
  2122.  
  2123. return $output;
  2124. }
  2125.  
  2126. }
  2127. add_shortcode('tw_sh_column_item', 'shortcode_tw_sh_column_item');
  2128.  
  2129.  
  2130.  
  2131. /* ================================================================================== */
  2132. /* Coming Soon Shortcode
  2133. /* ================================================================================== */
  2134.  
  2135. // Coming Soon
  2136. if (!function_exists('shortcode_tw_comingsoon')) {
  2137.  
  2138. function shortcode_tw_comingsoon($atts, $content) {
  2139. wp_enqueue_script('coming-soon', THEME_DIR . '/assets/js/jquery.comingsoon.js', false, false, true);
  2140. $atts = shortcode_atts(array(
  2141. 'coming_title' => '',
  2142. 'coming_years' => '2018',
  2143. 'coming_months' => '12',
  2144. 'coming_days' => '28',
  2145. 'coming_hours' => '12',
  2146. 'coming_link' => '',
  2147. ), $atts);
  2148. $output = '<div class="tw-cs-contain text-center"><h1 class="tw-coming-soon-title">' . $atts['coming_title'] . '</h1>';
  2149. $output .= '<div class="tw-coming-soon clearfix" data-years="' . $atts['coming_years'] . '" data-months="' . $atts['coming_months'] . '" data-days="' . $atts['coming_days'] . '" data-hours="' . $atts['coming_hours'] . '" data-minutes="00" data-seconds="00">';
  2150. $output .= '<div class="days">';
  2151. $output .= '<div class="count"></div>';
  2152. $output .= '<span class="coming-soon"></span><div class="text">' . __('DAYS', 'medusa') . '</div>';
  2153. $output .= '</div>';
  2154. $output .= '<div class="hours">';
  2155. $output .= '<div class="count"></div>';
  2156. $output .= '<span class="coming-soon"></span><div class="text">' . __('HOURS', 'medusa') . '</div>';
  2157. $output .= '</div>';
  2158. $output .= '<div class="minutes">';
  2159. $output .= '<div class="count"></div>';
  2160. $output .= '<span class="coming-soon"></span><div class="text">' . __('MINUTES', 'medusa') . '</div>';
  2161. $output .= '</div>';
  2162. $output .= '<div class="seconds">';
  2163. $output .= '<div class="count"></div>';
  2164. $output .= '<span class="coming-soon"></span><div class="text">' . __('SECONDS', 'medusa') . '</div>';
  2165. $output .= '</div>';
  2166. $output .= '</div>';
  2167. $output .= '<div class="tw-coming-soon-content">' . do_shortcode($content) . '</div>';
  2168. if ($atts['coming_link'] !== '') {
  2169. $feed = $atts['coming_link'];
  2170. $text = __('Your email here', 'medusa');
  2171. $submit = __('NOTIFY ME', 'medusa');
  2172. $output .= '<div class="subscribe-container">';
  2173. $output .= '<form action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open(\'http://feedburner.google.com/fb/a/mailverify?uri=' . $feed . '\', \'popupwindow\', \'scrollbars=yes,width=550,height=520\');return true">';
  2174. $output .= '<p>';
  2175. $output .= '<input type="text" value="" placeholder="' . $text . '" name="email">';
  2176. $output .= '<input class="btn" type="submit" name="imageField" value="' . $submit . '" alt="Submit" />';
  2177. $output .= '<input type="hidden" value="' . $feed . '" name="uri"/>';
  2178. $output .= '<input type="hidden" name="loc" value="en_US" />';
  2179. $output .= '</p>';
  2180. $output .= '</form>';
  2181. $output .= '</div>';
  2182. }
  2183. $output .= '</div>';
  2184. return $output;
  2185. }
  2186.  
  2187. }
  2188. add_shortcode('tw_comingsoon', 'shortcode_tw_comingsoon');
  2189.  
  2190.  
  2191.  
  2192. /* ================================================================================== */
  2193. /* Before After Shortcode
  2194. /* ================================================================================== */
  2195.  
  2196. // Before After
  2197. if (!function_exists('shortcode_tw_before_after')) {
  2198.  
  2199. function shortcode_tw_before_after($atts, $content) {
  2200. wp_enqueue_script('event-move', THEME_DIR . '/assets/js/jquery.event.move.js', false, false, true);
  2201. wp_enqueue_script('twentytwenty', THEME_DIR . '/assets/js/jquery.twentytwenty.js', false, false, true);
  2202. wp_enqueue_style('twentytwenty', THEME_DIR . '/assets/css/twentytwenty.css');
  2203. $atts = shortcode_atts(array(
  2204. 'before' => '',
  2205. 'after' => '',
  2206. ), $atts);
  2207. if (empty($atts['before'])) {
  2208. $atts['before'] = THEME_DIR . '/assets/img/no-image.png';
  2209. }
  2210. if (empty($atts['after'])) {
  2211. $atts['after'] = THEME_DIR . '/assets/img/no-image.png';
  2212. }
  2213. $output = '<div class="tw-before-after">';
  2214. $output .= '<img src="' . $atts['before'] . '" title="' . __('Before', 'medusa') . '" />';
  2215. $output .= '<img src="' . $atts['after'] . '" title="' . __('After', 'medusa') . '" />';
  2216. $output .= '</div>';
  2217.  
  2218. return $output;
  2219. }
  2220.  
  2221. }
  2222. add_shortcode('tw_before_after', 'shortcode_tw_before_after');
  2223.  
  2224. /* ================================================================================== */
  2225. /* Map Shortcode
  2226. /* ================================================================================== */
  2227. if (!function_exists('shortcode_tw_map')) {
  2228.  
  2229. function shortcode_tw_map($atts, $content) {
  2230. $atts = shortcode_atts(array(
  2231. 'type' => 'boxed'
  2232. ), $atts);
  2233.  
  2234. $output = '<div class="tw-map'.($atts['type']==='full'?' tw-full-element':'').'">';
  2235. $output .= $content;
  2236. $output .= '</div>';
  2237. return $output;
  2238. }
  2239.  
  2240. }
  2241. add_shortcode('tw_map', 'shortcode_tw_map');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement