templates.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. <?php
  2. /**
  3. * Various static template helpers
  4. *
  5. * @package vamtam/consulting
  6. */
  7. /**
  8. * class VamtamTemplates
  9. */
  10. class VamtamTemplates {
  11. private static $layout_cache = false;
  12. public static $in_page_wrapper = false;
  13. /**
  14. * Returns the current layout type and defines VAMTAM_LAYOUT accordingly
  15. *
  16. * @return string current page layout
  17. */
  18. public static function get_layout() {
  19. global $post;
  20. if ( ! self::$layout_cache ) {
  21. $has_left = VamtamSidebars::get_instance()->has_sidebar( 'left' );
  22. $has_right = VamtamSidebars::get_instance()->has_sidebar( 'right' );
  23. $layout_type = 'full';
  24. if ( $has_left && $has_right ) {
  25. $layout_type = 'left-right';
  26. } elseif ( $has_left ) {
  27. $layout_type = 'left-only';
  28. } elseif ( $has_right ) {
  29. $layout_type = 'right-only';
  30. }
  31. self::$layout_cache = $layout_type;
  32. }
  33. return self::$layout_cache;
  34. }
  35. /**
  36. * Echoes a pagination in the form of 1 2 [3] 4 5
  37. */
  38. public static function pagination_list( $query = null ) {
  39. if ( is_null( $query ) ) {
  40. $query = $GLOBALS['wp_query'];
  41. }
  42. $total_pages = (int) $query->max_num_pages;
  43. $output = '';
  44. if ( $total_pages > 1 ) {
  45. $big = PHP_INT_MAX;
  46. if ( isset( $query->query_vars['paged'] ) ) {
  47. $current_page = $query->query_vars['paged'];
  48. } else {
  49. $current_page = ( get_query_var( 'paged' ) > 1 ) ? get_query_var( 'paged' ) : ( get_query_var( 'page' ) ? get_query_var( 'page' ) : 1 );
  50. }
  51. $current_page = max( 1, $current_page );
  52. $output .= '<div class="wp-pagenavi vamtam-pagination-wrapper">';
  53. $output .= '<span class="pages">' . sprintf( esc_html__( 'Page %1$d of %2$d', 'vamtam-consulting' ), (int) $current_page, (int) $total_pages ) . '</span>';
  54. $output .= paginate_links( array( // xss ok
  55. 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
  56. 'format' => '?paged=%#%',
  57. 'current' => $current_page,
  58. 'total' => $total_pages,
  59. 'prev_text' => esc_html__( 'Prev', 'vamtam-consulting' ),
  60. 'next_text' => esc_html__( 'Next', 'vamtam-consulting' ),
  61. ) );
  62. $output .= '</div>';
  63. }
  64. return $output;
  65. }
  66. /**
  67. * Checks whether the main content area is currently being printed
  68. *
  69. * @return bool True immediately before displaying the left sidebar, false after the right sidebar has been displayed
  70. */
  71. public static function in_page_wrapper() {
  72. return self::$in_page_wrapper;
  73. }
  74. /**
  75. * Displays the pagination code based on the theme options or $pagination_type
  76. *
  77. * @param string|null $pagination_type overrides the pagination settings
  78. * @param bool $echo print or return the pagination code
  79. * @param array $other_vars vars passed to the remote handler - can be anything but elements must be whitelisted in VamtamLoadMore
  80. * @param object|null $query WP_Query object
  81. */
  82. public static function pagination( $pagination_type = null, $echo = true, $other_vars = array(), $query ) {
  83. $output = apply_filters( 'vamtam_pagination', null, $pagination_type );
  84. if ( is_archive() || is_search() ) {
  85. $pagination_type = 'paged';
  86. }
  87. if ( is_null( $output ) ) {
  88. if ( is_null( $pagination_type ) ) {
  89. $pagination_type = rd_vamtam_get_option( 'pagination-type' );
  90. }
  91. if ( 'load-more' === $pagination_type || 'infinite-scrolling' === $pagination_type ) {
  92. $max = $query->max_num_pages;
  93. $paged = 1;
  94. if ( isset( $query->query_vars['paged'] ) ) {
  95. $paged = $query->query_vars['paged'] ? $query->query_vars['paged'] : 1;
  96. } else {
  97. $paged = ( get_query_var( 'paged' ) > 1 ) ? get_query_var( 'paged' ) : ( get_query_var( 'page' ) ? get_query_var( 'page' ) : 1 );
  98. }
  99. $new_query = $query->query;
  100. $new_query['paged'] = $paged + 1;
  101. $class = 'lm-btn vamtam-button';
  102. if ( 'cube-load-more' === $pagination_type ) {
  103. $class .= ' vamtam-cube-load-more';
  104. }
  105. $output = '';
  106. if ( (int) $max > (int) $paged ) {
  107. $url = remove_query_arg( array( 'page', 'paged' ) );
  108. $url .= ( strpos( $url, '?' ) === false ) ? '?' : '&';
  109. $url .= 'paged=' . $new_query['paged'];
  110. if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
  111. $url = '#';
  112. }
  113. $btext = esc_html__( 'Load more', 'vamtam-consulting' );
  114. $output = '<div class="load-more clearboth vamtam-pagination-wrapper"><a href="' . esc_url( $url ) . '" class="' . esc_attr( $class ) . '" data-query="' . esc_attr( json_encode( $new_query ) ) . '" data-other-vars="' . esc_attr( json_encode( $other_vars ) ) . '"><span class="btext" data-text="' . esc_attr( strip_tags( $btext ) ) . '">' . $btext . '</span></a></div>';
  115. wp_enqueue_script( 'wp-mediaelement' );
  116. wp_enqueue_style( 'wp-mediaelement' );
  117. }
  118. } else {
  119. $output = self::pagination_list( $query );
  120. }
  121. }
  122. if ( $echo ) {
  123. echo $output; // xss ok
  124. } else {
  125. return $output;
  126. }
  127. }
  128. /**
  129. * Checks whether the current page has a title
  130. *
  131. * @return boolean whether the current page has a title
  132. */
  133. public static function has_page_header() {
  134. $post_id = vamtam_get_the_ID();
  135. // the event listing has its own title below the filter
  136. if ( ( function_exists( 'tribe_is_events_home' ) && tribe_is_events_home() ) || is_post_type_archive( 'tribe_events' ) ) {
  137. return false;
  138. }
  139. if ( is_null( $post_id ) || is_search() )
  140. return true;
  141. if ( is_single() && has_post_format( 'aside' ) )
  142. return false;
  143. return get_post_meta( $post_id, 'show-page-header', true ) !== 'false' && ! is_page_template( 'page-blank.php' );
  144. }
  145. /**
  146. * Returns a CSS string with background-related properties
  147. *
  148. * Since WP Core insists on supporting PHP 5.2, we can't even use __callStatic() to overload static methods
  149. * also no null coalescence
  150. */
  151. public static function build_background( $bg ) {
  152. if ( ! is_array( $bg ) ) {
  153. return '';
  154. }
  155. return self::build_background_full(
  156. isset( $bg['background-color'] ) ? $bg['background-color'] : '',
  157. isset( $bg['background-image'] ) ? $bg['background-image'] : '',
  158. isset( $bg['background-repeat'] ) ? $bg['background-repeat'] : '',
  159. isset( $bg['background-size'] ) ? $bg['background-size'] : '',
  160. isset( $bg['background-attachment'] ) ? $bg['background-attachment'] : '',
  161. isset( $bg['background-position'] ) ? $bg['background-position'] : ''
  162. );
  163. }
  164. public static function build_background_full( $bgcolor, $bgimage, $bgrepeat, $bgsize, $bgattachment, $bgposition = 'center top' ) {
  165. $style = '';
  166. if ( ! empty( $bgcolor ) ) {
  167. $style .= "background-color:$bgcolor;";
  168. if ( empty( $bgimage ) ) {
  169. $style .= 'background-image:none;';
  170. }
  171. }
  172. if ( ! empty( $bgimage ) ) {
  173. $style .= "background-image:url('$bgimage' );";
  174. if ( ! empty( $bgrepeat ) ) {
  175. $style .= "background-repeat:$bgrepeat;";
  176. }
  177. if ( ! empty( $bgsize ) ) {
  178. $style .= "background-size:$bgsize;";
  179. }
  180. if ( ! empty( $bgattachment ) ) {
  181. $style .= "background-attachment:$bgattachment;";
  182. }
  183. if ( ! empty( $bgposition ) ) {
  184. $style .= "background-position:$bgposition;";
  185. }
  186. }
  187. return $style;
  188. }
  189. /**
  190. * Page title background styles
  191. *
  192. * @return string background styles
  193. */
  194. public static function page_header_background() {
  195. $post_id = vamtam_get_the_ID();
  196. if ( is_null( $post_id ) || ! self::has_page_header() || is_archive() || is_search() )
  197. return '';
  198. $bgcolor = vamtam_sanitize_accent( vamtam_post_meta( $post_id, 'local-page-title-background-color', true ), 'css' );
  199. $bgimage = vamtam_post_meta( $post_id, 'local-page-title-background-image', true );
  200. $bgrepeat = vamtam_post_meta( $post_id, 'local-page-title-background-repeat', true );
  201. $bgsize = vamtam_post_meta( $post_id, 'local-page-title-background-size', true );
  202. $bgattachment = vamtam_post_meta( $post_id, 'local-page-title-background-attachment', true );
  203. $bgposition = vamtam_post_meta( $post_id, 'local-page-title-background-position', true );
  204. return self::build_background_full( $bgcolor, $bgimage, $bgrepeat, $bgsize, $bgattachment, $bgposition );
  205. }
  206. /**
  207. * Checks whether the current page has post siblings links
  208. *
  209. * @return boolean whether the current page has post siblings links
  210. */
  211. public static function has_post_siblings_buttons() {
  212. return is_singular( array( 'post', 'jetpack-portfolio', 'product' ) ) && current_theme_supports( 'vamtam-ajax-siblings' ) && ! is_page_template( 'page-blank.php' );
  213. }
  214. /**
  215. * Displays the page header
  216. *
  217. * @param bool $placed whether the title has already been output
  218. * @param string|null $title if set, overrides the current post title
  219. */
  220. public static function page_header( $placed = false, $title = null ) {
  221. if ( $placed ) return;
  222. global $post;
  223. if ( is_null( $title ) ) {
  224. $title = get_the_title();
  225. }
  226. $title_color = $layout = '';
  227. if ( isset( $post ) && isset( $post->ID ) ) {
  228. $title_color = vamtam_post_meta( $post->ID, 'local-page-title-color', true );
  229. $layout = vamtam_post_meta( $post->ID, 'local-page-title-layout', true );
  230. }
  231. $uses_local_title_layout = '';
  232. if ( empty( $layout ) ) {
  233. $layout = rd_vamtam_get_option( 'page-title-layout' );
  234. } elseif ( is_customize_preview() ) {
  235. $uses_local_title_layout = 'uses-local-title-layout';
  236. }
  237. $description = '';
  238. if ( ! empty( $title_color ) ) {
  239. $title_color = "color:$title_color";
  240. }
  241. if ( is_archive() ) {
  242. if ( vamtam_has_woocommerce() && is_shop() ) {
  243. $description = get_post_meta( wc_get_page_id( 'shop' ), 'description', true );
  244. } else {
  245. $description = get_the_archive_description();
  246. }
  247. } elseif ( ! is_search() && is_object( $post ) ) {
  248. $description = get_post_meta( $post->ID, 'description', true );
  249. }
  250. if ( has_post_format( 'link' ) && ! empty( $title ) ) {
  251. $title = "<a href='" . vamtam_post_meta( vamtam_get_the_ID(), 'vamtam-post-format-link', true ) . "' target='_blank'>$title</a>";
  252. }
  253. if ( VamtamTemplates::has_page_header() && ! empty( $title ) ) {
  254. include locate_template( 'templates/header/page-title.php' );
  255. }
  256. }
  257. /**
  258. * Comments template
  259. *
  260. * @param object $comment comment data
  261. * @param array $args comment arguments
  262. * @param int $depth comment depth
  263. */
  264. public static function comments( $comment, $args, $depth ) {
  265. include locate_template( 'templates/comment' . ( isset( $args['vamtam-layout'] ) ? '-' . $args['vamtam-layout'] : '' ) . '.php' );
  266. }
  267. /**
  268. * Displays the icon for a post format $format
  269. * @param string $format post format slug
  270. * @return string icon html
  271. */
  272. public static function post_format_icon( $format ) {
  273. ?>
  274. <a class="single-post-format" href="<?php echo esc_url( add_query_arg( 'format_filter',$format, home_url( '/' ) ) ) ?>" title="<?php echo esc_attr( get_post_format_string( $format ) ) ?>">
  275. <?php echo do_shortcode( '[icon name="' . VamtamPostFormats::get_post_format_icon( $format ) . '"]' ) ?>
  276. </a>
  277. <?php
  278. }
  279. /**
  280. * Outputs the page title styles
  281. */
  282. public static function get_title_style() {
  283. $post_id = vamtam_get_the_ID();
  284. if ( ! current_theme_supports( 'vamtam-page-title-style' ) || is_null( $post_id ) )
  285. return;
  286. $bgcolor = vamtam_sanitize_accent( vamtam_post_meta( $post_id, 'local-title-background-color', true ), 'css' );
  287. $bgimage = vamtam_post_meta( $post_id, 'local-title-background-image', true );
  288. $bgrepeat = vamtam_post_meta( $post_id, 'local-title-background-repeat', true );
  289. $bgsize = vamtam_post_meta( $post_id, 'local-title-background-size', true );
  290. $bgattachment = vamtam_post_meta( $post_id, 'local-title-background-attachment', true );
  291. $bgposition = vamtam_post_meta( $post_id, 'local-title-background-position', true );
  292. $style = '';
  293. if ( ! empty( $bgcolor ) ) {
  294. $style .= "background-color:$bgcolor;";
  295. }
  296. if ( ! empty( $bgimage ) ) {
  297. $style .= "background-image:url('$bgimage' );";
  298. if ( ! empty( $bgrepeat ) ) {
  299. $style .= "background-repeat:$bgrepeat;";
  300. }
  301. if ( ! empty( $bgsize ) ) {
  302. $style .= "background-size:$bgsize;";
  303. }
  304. }
  305. return $style;
  306. }
  307. /**
  308. * Checks whether the current page has a header slider
  309. * @return boolean true if there is a header slider
  310. */
  311. public static function has_header_slider() {
  312. $post_id = vamtam_get_the_ID();
  313. return ! is_null( $post_id ) &&
  314. apply_filters(
  315. 'vamtam_has_header_slider',
  316. ( ! is_404() && vamtam_post_meta( $post_id, 'slider-category', true ) !== '' && ! is_page_template( 'page-blank.php' ) )
  317. );
  318. }
  319. /**
  320. * This is used to determine whether Cube Portfolio should be enqueued as normal,
  321. * or if it should be loader later (on DOMContentLoaded)
  322. *
  323. * @return book true if cubeportfolio.js should be enqueued early
  324. */
  325. public static function early_cube_load() {
  326. return ! self::has_header_slider() && ! self::has_page_header() && ! is_home();
  327. }
  328. /**
  329. * Returns true if this is the WP login page
  330. *
  331. * @return bool whether the current page is wp-login
  332. */
  333. public static function is_login() {
  334. return strpos( $_SERVER['PHP_SELF'], 'wp-login.php' ) !== false;
  335. }
  336. /**
  337. * Returns the list of all embeddable sliders to be used in the config generator
  338. *
  339. * @return array list of sliders
  340. */
  341. public static function get_all_sliders() {
  342. return array_merge( self::get_layer_sliders(), self::get_rev_sliders() );
  343. }
  344. /**
  345. * Returns the list of Revolution Slider sliders in 'revslider-ID' => 'Name' array
  346. * @return array list of Revolution Slider WP sliders
  347. */
  348. public static function get_rev_sliders( $prefix = 'revslider-' ) {
  349. $result = array();
  350. if ( class_exists( 'RevSlider' ) ) {
  351. $revslider = new RevSlider();
  352. $sliders = $revslider->getArrSliders();
  353. foreach ( $sliders as $item ) {
  354. $result[ $prefix . $item->getAlias() ] = $item->getTitle();
  355. }
  356. }
  357. return $result;
  358. }
  359. /**
  360. * Returns the list of LayerSlider sliders in 'layerslider-ID' => 'Name' array
  361. * @return array list of LayerSlider WP sliders
  362. */
  363. public static function get_layer_sliders( $prefix = 'layerslider-' ) {
  364. $result = array();
  365. if ( class_exists( 'LS_Sliders' ) ) {
  366. $sliders = LS_Sliders::find(
  367. array(
  368. 'orderby' => 'date_m',
  369. 'limit' => 10000,
  370. 'data' => false,
  371. )
  372. );
  373. foreach ( $sliders as $item ) {
  374. $result[ $prefix . $item['id'] ] = $item['name'];
  375. }
  376. }
  377. return $result;
  378. }
  379. /**
  380. * The formatted output of a list of pages.
  381. *
  382. * Displays page links for paginated posts ( i.e. includes the "nextpage".
  383. * Quicktag one or more times ). This tag must be within The Loop.
  384. *
  385. * The defaults for overwriting are:
  386. * 'next_or_number' - Default is 'number' ( string ). Indicates whether page
  387. * numbers should be used. Valid values are number and next.
  388. * 'nextpagelink' - Default is 'Next Page' ( string ). Text for link to next page.
  389. * of the bookmark.
  390. * 'previouspagelink' - Default is 'Previous Page' ( string ). Text for link to
  391. * previous page, if available.
  392. * 'pagelink' - Default is '%' ( String ).Format string for page numbers. The % in
  393. * the parameter string will be replaced with the page number, so Page %
  394. * generates "Page 1", "Page 2", etc. Defaults to %, just the page number.
  395. * 'before' - Default is '<p id="post-pagination"> Pages:' ( string ). The html
  396. * or text to prepend to each bookmarks.
  397. * 'after' - Default is '</p>' ( string ). The html or text to append to each
  398. * bookmarks.
  399. * 'text_before' - Default is '' ( string ). The text to prepend to each Pages link
  400. * inside the <a> tag. Also prepended to the current item, which is not linked.
  401. * 'text_after' - Default is '' ( string ). The text to append to each Pages link
  402. * inside the <a> tag. Also appended to the current item, which is not linked.
  403. *
  404. * @param string|array $args Optional. Overwrite the defaults.
  405. * @return string Formatted output in HTML.
  406. */
  407. public static function custom_link_pages( $args = '' ) {
  408. $defaults = array(
  409. 'before' => '<p id="post-pagination">' . esc_html__( 'Pages:', 'vamtam-consulting' ),
  410. 'after' => '</p>',
  411. 'text_before' => '',
  412. 'text_after' => '',
  413. 'next_or_number' => 'number',
  414. 'nextpagelink' => esc_html__( 'Next page', 'vamtam-consulting' ),
  415. 'previouspagelink' => esc_html__( 'Previous page', 'vamtam-consulting' ),
  416. 'pagelink' => '%',
  417. 'echo' => 1,
  418. );
  419. $r = wp_parse_args( $args, $defaults );
  420. $r = apply_filters( 'wp_link_pages_args', $r );
  421. extract( $r, EXTR_SKIP );
  422. global $page, $numpages, $multipage, $more, $pagenow;
  423. $output = '';
  424. if ( $multipage ) {
  425. if ( 'number' == $next_or_number ) {
  426. $output .= $before;
  427. for ( $i = 1; $i < ( $numpages + 1 ); $i = $i + 1 ) {
  428. $j = str_replace( '%', $i, $pagelink );
  429. $output .= ' ';
  430. if ( $i != $page || ( ( ! $more ) && ( $page == 1 ) ) )
  431. $output .= _wp_link_page( $i );
  432. else $output .= '<span class="current">';
  433. $output .= $text_before . $j . $text_after;
  434. if ( $i != $page || ( ( ! $more ) && ( $page == 1 ) ) )
  435. $output .= '</a>';
  436. else $output .= '</span>';
  437. }
  438. $output .= $after;
  439. } else {
  440. if ( $more ) {
  441. $output .= $before;
  442. $i = $page - 1;
  443. if ( $i && $more ) {
  444. $output .= _wp_link_page( $i );
  445. $output .= $text_before . $previouspagelink . $text_after . '</a>';
  446. }
  447. $i = $page + 1;
  448. if ( $i <= $numpages && $more ) {
  449. $output .= _wp_link_page( $i );
  450. $output .= $text_before . $nextpagelink . $text_after . '</a>';
  451. }
  452. $output .= $after;
  453. }
  454. }
  455. }
  456. if ( $echo ) {
  457. echo $output; // xss ok
  458. }
  459. return $output;
  460. }
  461. public static function project_tax( $tax ) {
  462. $project_types = get_the_terms( get_the_id(), $tax );
  463. $links = array();
  464. foreach ( $project_types as $project_type ) {
  465. $project_type_link = get_term_link( $project_type, $tax );
  466. if ( is_wp_error( $project_type_link ) ) {
  467. return $project_type_link;
  468. }
  469. $links[] = '<a href="' . esc_url( $project_type_link ) . '" rel="tag">' . esc_html( $project_type->name ) . '</a>';
  470. }
  471. return $links;
  472. }
  473. public static function scrollable_columns( $max ) {
  474. global $content_width;
  475. if ( 0 === $max ) {
  476. $max = 11;
  477. }
  478. $min = apply_filters( 'vamtam-scrollable-columns-minimum', 1 ); // should be replaced with min( 2, $max ); if a minimum of two columns is required
  479. $queries = array();
  480. $step = ( $content_width - 120 ) / 4;
  481. // start from site_width/4, increment column count by 1 for every $step px
  482. for ( $cols = $min; $cols <= $max; ++$cols ) {
  483. $queries[] = array(
  484. 'width' => ( $cols === $min ? 1 : $cols ) * $step,
  485. 'cols' => $cols,
  486. );
  487. }
  488. $queries = array_reverse( $queries );
  489. return apply_filters( 'vamtam-scrollable-columns', $queries, $max );
  490. }
  491. /**
  492. * Prints display: none if $visible is false
  493. *
  494. * @param bool $visible
  495. */
  496. public static function display_none( $visible, $with_attr = true ) {
  497. if ( ! $visible ) {
  498. if ( $with_attr ) {
  499. echo 'style="display:none"';
  500. } else {
  501. echo 'display:none;';
  502. }
  503. }
  504. }
  505. public static function shortcode( $name, $atts, $content = null ) {
  506. $function_name = 'vamtam_shortcode_' . $name;
  507. if ( ! function_exists( $function_name ) ) {
  508. return '<!-- ' . sprintf( esc_html__( '%s not found.', 'vamtam-consulting' ), $function_name ) . '-->';
  509. }
  510. if ( is_null( $content ) ) {
  511. return call_user_func( $function_name, $atts );
  512. }
  513. return call_user_func( $function_name, $atts, $content );
  514. }
  515. public static function the_author_posts_link_with_icon() {
  516. global $authordata;
  517. if ( ! is_object( $authordata ) ) {
  518. return;
  519. }
  520. $link = sprintf(
  521. '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
  522. esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),
  523. esc_attr( sprintf( __( 'Posts by %s', 'vamtam-consulting' ), get_the_author() ) ),
  524. vamtam_get_icon_html( array(
  525. 'name' => 'vamtam-theme-pencil2',
  526. ) ) . '' . get_the_author()
  527. );
  528. /**
  529. * Filters the link to the author page of the author of the current post.
  530. *
  531. * @since 2.9.0
  532. *
  533. * @param string $link HTML link.
  534. */
  535. echo wp_kses_post( apply_filters( 'the_author_posts_link', $link ) );
  536. }
  537. public static function remove_outer_columns( $text ) {
  538. $text = preg_replace( '/\[column.*?\]/', '', $text );
  539. $text = preg_replace( '/\[\/column.*?\]/', '', $text );
  540. return $text;
  541. }
  542. public static function lazyload_image( $thumbnail_id, $size, $attr = '' ) {
  543. return VamtamOverrides::post_thumbnail_html( wp_get_attachment_image( $thumbnail_id, 'full' ), null, $thumbnail_id, $size, $attr );
  544. }
  545. }