"> <div class="last-posts__item__container<?php if ($allow_shadow && $image) { echo ' last-posts__item__container--flex'; } ?> "> <?php if ($image) { printf('<a href="%s" class="last-posts__item__image-wrap">%s</a>', $post_link_escaped, $image); } $item_content_html = sprintf('<div class="last-posts__item__content"> <h3 class="last-posts__item__title"><a href="%1$s">%2$s</a></h3> <div class="last-posts__item__description">%3$s</div> <a href="%1$s" class="atbtn atbtn--rounded atbtn--medium atbtn--light">%4$s<i class="atbtn__icon atbtn__icon--right fa fa-long-arrow-right"></i></a> </div>', $post_link_escaped, esc_html($post->post_title), adventure_tours_do_excerpt($post->post_content, $words_limit), esc_html($read_more_text)); echo $item_content_html; ?> </div> <?php if ($allow_shadow && $image) { printf('<div class="last-posts__item__content-flex-shadow">%s</div>', $item_content_html); } ?> </div> <?php if ($render_limit > 0 && --$render_limit < 1) { break; } } ?>
?> "> <div class="last-posts__item__container"> <?php printf('<a href="%s" class="last-posts__item__image-wrap">%s</a>', esc_url($post_link), $image); ?> <div class="last-posts__item__content"> <h3 class="last-posts__item__title"><a href="<?php echo esc_url($post_link); ?> "><?php echo esc_html($post->post_title); ?> </a></h3> <div class="last-posts__item__description"><?php echo adventure_tours_do_excerpt($post->post_content, $words_limit); ?> </div> <a href="<?php echo esc_url($post_link); ?> " class="atbtn atbtn--rounded atbtn--medium atbtn--light"><?php echo esc_html($read_more_text); ?> <i class="atbtn__icon atbtn__icon--right fa fa-long-arrow-right"></i></a> </div> </div> </div> <?php if ($render_limit > 0 && --$render_limit < 1) { break;
/** * Returns short description for current post or for the specefied post. * * @param WP_Post $forPost optional post object (if empty - current post will be used). * @param int $word_limit max allowed words count. * @return string */ function adventure_tours_get_short_description($forPost = null, $word_limit = null) { if (null === $forPost) { $forPost = get_post(); } if (!$forPost) { return ''; } $text = $forPost->post_excerpt ? $forPost->post_excerpt : $forPost->post_content; if ($text) { return adventure_tours_do_excerpt($text, $word_limit); } else { return $text; } }