Advertisement
Guest User

Untitled

a guest
May 16th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.74 KB | None | 0 0
  1. <?php
  2.  
  3. add_filter('lae_gallery_image_lightbox_link', 'mytheme_modify_gallery_lightbox', 10, 3);
  4.  
  5. function mytheme_modify_gallery_lightbox($output, $item, $settings) {
  6.  
  7. $anchor_type = (empty($item['item_link']['url']) ? 'lae-click-anywhere' : 'lae-click-icon');
  8.  
  9. $output = '<a class="lae-lightbox-item ' . $anchor_type . '" data-fancybox="' . $settings['gallery_class'] . '" href="' . $item['item_image']['url'] . '" data-elementor-open-lightbox="no" title="' . esc_html($item['item_name']) . '" data-description="' . wp_kses_post($item['item_description']) . '">';
  10.  
  11. $output .= '<i class="lae-icon-full-screen"></i>';
  12.  
  13. $output .= '</a>';
  14.  
  15. return $output;
  16.  
  17. }
  18.  
  19. add_filter('lae_gallery_entry_text', 'mytheme_add_inline_title_for_videos', 10, 3);
  20.  
  21. function mytheme_add_inline_title_for_videos($entry_text, $item, $settings) {
  22.  
  23. $target = $item['item_link']['is_external'] ? 'target="_blank"' : '';
  24.  
  25. $entry_text = '<a href="' . esc_url($item['item_link']['url']) . '" title="' . esc_html($item['item_name']) . '"' . $target . '>' . esc_html($item['item_name']) . '</a>';
  26.  
  27. $entry_text = '<div class="entry-title">' . $entry_text . '</div>';
  28.  
  29. $entry_text .= '<div class="entry-description">' . esc_html($item['item_description']) . '</div>';
  30.  
  31. return $entry_text;
  32.  
  33. }
  34.  
  35. add_filter('lae_image_slider_flexslider_slider_button_output', 'mytheme_image_slider_slider_button_output', 10, 3);
  36. add_filter('lae_image_slider_slickslider_slider_button_output', 'mytheme_image_slider_slider_button_output', 10, 3);
  37. add_filter('lae_image_slider_responsiveslider_slider_button_output', 'mytheme_image_slider_slider_button_output', 10, 3);
  38.  
  39. function mytheme_image_slider_slider_button_output($slider_button, $slide, $settings) {
  40.  
  41. $button_type = ' my-custom-class'; // put your class here
  42.  
  43. $color_class = ' lae-' . esc_attr($slide['button_color']);
  44.  
  45. if (!empty($slide['button_type']))
  46. $button_type = ' lae-' . esc_attr($slide['button_type']);
  47.  
  48. $rounded = ($slide['rounded'] == 'yes') ? ' lae-rounded' : '';
  49.  
  50. $slider_button = '<a class="lae-button ' . $color_class . $button_type . $rounded
  51. . '" href="' . esc_url($slide['button_url']['url'])
  52. . '" ' . (($slide['button_url']['is_external']) ? ' target="_blank"' : '')
  53. . '>' . $slide['button_text'] . '</a>';
  54.  
  55. return $slider_button;
  56.  
  57. }
  58.  
  59. add_filter('lvca_gallery_entry_text', 'mytheme_add_inline_title_for_images', 10, 3);
  60.  
  61. function mytheme_add_inline_title_for_images($entry_text, $item, $settings) {
  62.  
  63. $link = NULL;
  64.  
  65. if (!empty($item['link'])) {
  66.  
  67. if (function_exists('vc_build_link'))
  68. $link = vc_build_link($item['link']);
  69. else
  70. $link = explode('|', $item['link']);
  71. }
  72.  
  73. $entry_text = '<h3 class="lvca-entry-title">';
  74.  
  75. if (!empty($link)):
  76.  
  77. $entry_text .= '<a href="' . esc_url($link['url'])
  78. . '" title="' . esc_html($link['title'])
  79. . '" target="' . esc_html($link['target'])
  80. . '">' . esc_html($item['name']) . '</a>';
  81.  
  82. else:
  83.  
  84. $entry_text .= esc_html($item['name']);
  85.  
  86. endif;
  87.  
  88. $entry_text .= '</h3>';
  89.  
  90. $entry_text = '<div class="entry-title">' . $entry_text . '</div>';
  91.  
  92. $entry_text .= '<div class="entry-description">' . esc_html($item['description']) . '</div>';
  93.  
  94. return $entry_text;
  95.  
  96. }
  97.  
  98. add_filter('lsow_block_header_1_taxonomy_filter_output', 'mytheme_modify_posts_grid_filter', 10, 2);
  99.  
  100. function mytheme_modify_posts_grid_filter($header_output, $header_obj) {
  101.  
  102. $header_output = ''; // custom html - pls look at method get_block_taxonomy_filter() in includes/blocks/block-header.php
  103.  
  104. return $header_output;
  105.  
  106. }
  107.  
  108. add_filter('lsow_posts_carousel_entry_excerpt', 'mytheme_modify_posts_carousel_excerpt', 10, 3);
  109.  
  110. function mytheme_modify_posts_carousel_excerpt($output, $post_id, $settings) {
  111.  
  112. $output .= '<div class="lsow-read-more">';
  113.  
  114. $output .= '<a href="' . get_the_permalink($post_id) . '">' . __('Read More', 'my-theme') . '</a>';
  115.  
  116. $output .= '</div>';
  117.  
  118. return $output;
  119.  
  120. }
  121.  
  122. add_filter('lae_taxonomies_info', 'mytheme_modify_taxonomies_info', 10, 2);
  123.  
  124. function mytheme_modify_taxonomies_info($output, $taxonomies) {
  125.  
  126. $output .= '';
  127.  
  128. return $output;
  129.  
  130. }
  131.  
  132. add_filter('lae_posts_grid_xvbsgh_query_args', 'mytheme_modify_posts_grid_query1', 10, 2);
  133.  
  134. function mytheme_modify_posts_grid_query1($query_args, $settings) {
  135.  
  136. $query_args['post__not_in'] = array('1234'); // exclude post 1234
  137.  
  138. return $query_args;
  139.  
  140. }
  141.  
  142. add_filter('lae_block_d4c918d_query_args', 'mytheme_modify_posts_grid_query2', 10, 2);
  143.  
  144. function mytheme_modify_posts_grid_query2($query_args, $settings) {
  145.  
  146. $query_args['ignore_sticky_posts'] = 0; // do not ignore sticky posts
  147.  
  148. if (is_front_page()) {
  149. $query_args['post__not_in'] = array(35139, 35069, 35037);
  150. }
  151.  
  152. return $query_args;
  153. }
  154.  
  155. add_filter('lae_block_filter_terms', 'mytheme_modify_block_filter_terms', 10, 2);
  156.  
  157. function mytheme_modify_block_filter_terms($block_filter_terms, $block) {
  158.  
  159. // sort the $block_filter_terms and return the sorted array
  160.  
  161. $sorted_terms = array();
  162.  
  163. $taxonomies[] = $this->settings['taxonomy_chosen'];
  164.  
  165. $this->settings['taxonomies'] = $taxonomies;
  166.  
  167. if ($this->settings['filterable']) {
  168.  
  169. $terms = get_terms(array(
  170. 'taxonomy' => $taxonomies[0],
  171. 'orderby' => 'name',
  172. 'order' => 'DESC'
  173. ));
  174.  
  175. if (!empty($terms) && !is_wp_error($terms)) {
  176. $sorted_terms = $terms;
  177. }
  178. }
  179.  
  180. return $sorted_terms;
  181.  
  182. }
  183.  
  184.  
  185. add_filter('lae_gallery_block_filter_terms', 'mytheme_modify_gallery_block_filter_terms', 10, 2);
  186.  
  187. function mytheme_modify_gallery_block_filter_terms($block_filter_terms, $block) {
  188.  
  189. // sort the $block_filter_terms and return the sorted array
  190.  
  191. $tags = $terms = array();
  192.  
  193. foreach ($block->block_items as $item) {
  194. if (!empty($item['item_tags']))
  195. $tags = array_merge($tags, explode(',', $item['item_tags']));
  196. }
  197.  
  198. // trim whitespaces before applying array_unique
  199. $tags = array_map('trim', $tags);
  200.  
  201. $success = sort(array_values(array_unique($tags))); // SORT HERE
  202.  
  203. if ($success && $block->settings['filterable']) {
  204.  
  205. foreach ($tags as $tag) {
  206.  
  207. $term = array();
  208.  
  209. $term['term_id'] = preg_replace('/\s+/', '-', $tag); // use the unique tag name itself as an id
  210.  
  211. $term['name'] = $tag;
  212.  
  213. $term['taxonomy'] = 'gallery_tag';
  214.  
  215. $terms[] = (object)$term;
  216. }
  217. }
  218.  
  219. return $terms;
  220.  
  221. }
  222.  
  223. add_filter('lvca_posts_carousel_entry_excerpt', 'mytheme_modify_posts_carousel_excerpt1', 10, 3);
  224.  
  225. function mytheme_modify_posts_carousel_excerpt1($excerpt, $post_id, $settings) {
  226.  
  227. $output = wp_trim_words($excerpt, 40, '...');
  228.  
  229. return $output;
  230.  
  231. }
  232.  
  233. add_filter('lae_taxonomy_terms_dropdown_limit', 'mytheme_taxonomy_terms_dropdown_limit', 10, 1);
  234.  
  235. function mytheme_taxonomy_terms_dropdown_limit($limit) {
  236.  
  237. $limit = 5000;
  238.  
  239. return $limit;
  240.  
  241. }
  242.  
  243.  
  244. add_filter('lae_block_d4c918d_query_args', 'mytheme_modify_posts_grid_query3', 10, 2);
  245.  
  246. function mytheme_modify_posts_grid_query3($query_args, $settings) {
  247.  
  248. $query_args = array(
  249. 'post_type' => 'page',
  250. 'posts_per_page' => -1,
  251. 'post_parent' => 123,
  252. 'order' => 'ASC',
  253. 'orderby' => 'menu_order'
  254. );
  255.  
  256. return $query_args;
  257.  
  258. }
  259.  
  260. add_filter('lae_posts_grid_xvbsgh_query_args', 'mytheme_modify_posts_grid_query4', 10, 2);
  261.  
  262. function mytheme_modify_posts_grid_query4($query_args, $settings) {
  263.  
  264. global $post;
  265.  
  266. $query_args = array(
  267. 'post_type' => 'page',
  268. 'posts_per_page' => -1,
  269. 'post_parent' => $post->ID,
  270. 'order' => 'ASC',
  271. 'orderby' => 'menu_order'
  272. );
  273.  
  274. return $query_args;
  275.  
  276. }
  277.  
  278. add_filter('lae_block_d4c918d_query_args', 'mytheme_modify_posts_grid_query5', 10, 2);
  279.  
  280. function mytheme_modify_posts_grid_query5($query_args, $settings) {
  281.  
  282. global $post;
  283.  
  284. $query_args = array(
  285. 'post_type' => 'page',
  286. 'posts_per_page' => -1,
  287. 'post_parent' => $post->ID,
  288. 'order' => 'ASC',
  289. 'orderby' => 'menu_order'
  290. );
  291.  
  292. return $query_args;
  293.  
  294. }
  295.  
  296.  
  297. add_filter('lae_block_module_3', 'mytheme_modify_module_3', 10, 2);
  298.  
  299. function mytheme_modify_module_3($output, $source) {
  300.  
  301. ob_start();
  302. ?>
  303.  
  304. <div class="lae-module-3 lae-small-thumb">
  305.  
  306. <?php echo $source->get_thumbnail('thumbnail'); ?>
  307.  
  308. <div class="lae-entry-details">
  309.  
  310. <?php echo $source->get_title(); ?>
  311.  
  312. <div class="lae-module-meta">
  313.  
  314. <?php echo $source->get_date(); ?>
  315.  
  316. </div>
  317.  
  318. </div>
  319.  
  320. </div>
  321.  
  322. <?php $output = ob_get_clean();
  323.  
  324. return $output;
  325.  
  326. }
  327.  
  328.  
  329. add_filter('labb_gallery_entry_text', 'mytheme_display_description', 10, 3);
  330.  
  331. function mytheme_display_description($entry_text, $item, $settings) {
  332.  
  333. $entry_text = '<div class="labb-entry-description">' . wp_kses_post($item->item_description) . '</div>';
  334.  
  335. return $entry_text;
  336.  
  337. }
  338.  
  339.  
  340. add_filter('lae_posts_carousel_entry_excerpt', 'mytheme_modify_posts_carousel_entry_excerpt', 10, 3);
  341.  
  342. function mytheme_modify_posts_carousel_entry_excerpt($excerpt, $post_id, $settings) {
  343.  
  344. $excerpt = '<div class="lae-entry-content">';
  345.  
  346. $excerpt .= apply_filters('the_content', get_post_field('post_content', $post_id));
  347.  
  348. $excerpt .= '</div>';
  349.  
  350. return $excerpt;
  351.  
  352. }
  353.  
  354. add_filter('lae_block_filter_terms', 'mytheme_modify_block_filter_terms1', 10, 2);
  355.  
  356. function mytheme_modify_block_filter_terms1($block_filter_terms, $block) {
  357.  
  358. // sort the $block_filter_terms and return the sorted array
  359.  
  360. $sorted_terms = array();
  361.  
  362. $taxonomies[] = $this->settings['taxonomy_chosen'];
  363.  
  364. $this->settings['taxonomies'] = $taxonomies;
  365.  
  366. if ($this->settings['filterable']) {
  367.  
  368. $terms = get_terms(array(
  369. 'taxonomy' => $taxonomies[0],
  370. 'orderby' => 'name',
  371. 'order' => 'DESC'
  372. ));
  373.  
  374. if (!empty($terms) && !is_wp_error($terms)) {
  375. $sorted_terms = $terms;
  376. }
  377. }
  378.  
  379. return $sorted_terms;
  380.  
  381. }
  382.  
  383. add_filter('lae_posts_grid_xvbsgh_query_args', 'mytheme_modify_posts_grid_query6', 10, 2);
  384.  
  385. function mytheme_modify_posts_grid_query6($query_args, $settings) {
  386.  
  387. global $post;
  388.  
  389. $query_args = array(
  390. 'post_type' => 'page',
  391. 'posts_per_page' => -1,
  392. 'post_parent' => $post->ID,
  393. 'order' => 'ASC',
  394. 'orderby' => 'menu_order'
  395. );
  396.  
  397. return $query_args;
  398.  
  399. }
  400.  
  401. add_filter('lvca_posts_carousel_entry_excerpt', 'mytheme_modify_posts_carousel_entry_excerpt1', 10, 3);
  402.  
  403. function mytheme_modify_posts_carousel_entry_excerpt1($excerpt, $post_id, $settings) {
  404.  
  405. $excerpt = '<div class="entry-summary">';
  406.  
  407. $post = get_post($post_id);
  408.  
  409. $excerpt_count = 100;
  410.  
  411. if (empty($post->post_excerpt))
  412. $excerpt .= $post->post_content;
  413. else
  414. $excerpt .= $post->post_excerpt;
  415.  
  416. $excerpt .= strip_shortcodes(force_balance_tags(html_entity_decode(wp_trim_words(htmlentities($excerpt), $excerpt_count, '…'))));
  417.  
  418. $excerpt .= '</div>';
  419.  
  420. return $excerpt;
  421.  
  422. }
  423.  
  424. add_filter('lae_posts_grid_entry_image', 'mytheme_modify_posts_grid_entry_image', 10, 3);
  425.  
  426. function mytheme_modify_posts_grid_entry_image($entry_image, $image_setting, $settings) {
  427.  
  428. $entry_image = '';
  429.  
  430. return $entry_image;
  431.  
  432. }
  433.  
  434. add_filter('lae_post_item_excerpt', 'mytheme_modify_posts_grid_entry_excerpt', 10, 2);
  435.  
  436. function mytheme_modify_posts_grid_entry_excerpt($output, $source) {
  437.  
  438. if ($source->settings['display_summary']) :
  439.  
  440. $excerpt_count = $source->settings['excerpt_length'];
  441.  
  442. $output = '<div class="entry-summary">';
  443.  
  444. if (empty($source->post->post_excerpt))
  445. $excerpt = $source->post->post_content;
  446. else
  447. $excerpt = $source->post->post_excerpt;
  448.  
  449. if ($source->settings['rich_text_excerpt'])
  450. $output .= do_shortcode(force_balance_tags(html_entity_decode(wp_trim_words(htmlentities($excerpt), $excerpt_count, '…'))));
  451. else
  452. $output .= wp_trim_words(wp_strip_all_tags(strip_shortcodes($excerpt)), $excerpt_count, '…');
  453.  
  454. $output .= '</div><!-- .entry-summary -->';
  455.  
  456. endif;
  457.  
  458. return $output;
  459.  
  460. }
  461.  
  462. add_filter('lae_block_d4c918d_query_args', 'mytheme_modify_posts_grid_query7', 10, 2);
  463.  
  464. function mytheme_modify_posts_grid_query7($query_args, $settings) {
  465.  
  466. $query_args['ignore_sticky_posts'] = 0; // do not ignore sticky posts
  467.  
  468. if (is_front_page()) {
  469. $query_args['post__not_in'] = array(35139, 35069, 35037);
  470.  
  471. return $query_args;
  472.  
  473. }
  474. }
  475.  
  476. add_filter('lae_posts_carousel_entry_excerpt', 'mytheme_modify_posts_carousel_add_read_more', 10, 3);
  477.  
  478. function mytheme_modify_posts_carousel_add_read_more($excerpt, $post_id, $settings) {
  479.  
  480. $read_more_text = __('Read More', 'livemesh-el-addons');
  481.  
  482. $excerpt .= '<div class="lae-read-more">';
  483.  
  484. $excerpt .= '<a class="lae-button" href="' . get_the_permalink($post_id) . '">' . $read_more_text . '</a>';
  485.  
  486. $excerpt .= '</div>';
  487.  
  488. return $excerpt;
  489.  
  490. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement