function st_change_comment_excerpt_limit($comment)
 {
     return TravelHelper::cutnchar($comment, 55);
 }
Example #2
0
        public function widget($args, $instance)
        {
            $cache = array();
            if (!$this->is_preview()) {
                $cache = wp_cache_get('widget_st_list_entries', 'widget');
            }
            if (!is_array($cache)) {
                $cache = array();
            }
            if (!isset($args['widget_id'])) {
                $args['widget_id'] = $this->id;
            }
            if (isset($cache[$args['widget_id']])) {
                echo balanceTags($cache[$args['widget_id']]);
                return;
            }
            ob_start();
            $title = !empty($instance['title']) ? $instance['title'] : __('Recent Posts', ST_TEXTDOMAIN);
            /** This filter is documented in wp-includes/default-widgets.php */
            $title = apply_filters('widget_title', $title, $instance, $this->id_base);
            $number = !empty($instance['number']) ? absint($instance['number']) : 5;
            if (!$number) {
                $number = 5;
            }
            $show_date = isset($instance['show_date']) ? $instance['show_date'] : false;
            $orderby = isset($instance['orderby']) ? $instance['orderby'] : "views_count";
            $order = isset($instance['order']) ? $instance['order'] : "ASC";
            /**
             * Filter the arguments for the Recent Posts widget.
             *
             * @since 3.4.0
             *
             * @see WP_Query::get_posts()
             *
             * @param array $args An array of arguments used to retrieve the recent posts.
             */
            $arg = array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'order' => $order);
            if ($orderby == 'views_count') {
                $arg['meta_key'] = 'post_views_count';
                $arg['orderby'] = 'meta_value';
            } else {
                $arg['orderby'] = $orderby;
            }
            $r = new WP_Query(apply_filters('widget_posts_args', $arg));
            if ($r->have_posts()) {
                ?>
                    <?php 
                echo balanceTags($args['before_widget']);
                ?>
                    <?php 
                if ($title) {
                    echo $args['before_title'] . $title . $args['after_title'];
                }
                ?>
                    <ul class="thumb-list">
                        <?php 
                while ($r->have_posts()) {
                    $r->the_post();
                    ?>
                            <li>
                                <a href="<?php 
                    the_permalink();
                    ?>
">
                                    <?php 
                    the_post_thumbnail(array(70, 70, 'bfi_thumb' => true));
                    ?>
                                </a>
                                <div class="thumb-list-item-caption">
                                    <?php 
                    if ($show_date) {
                        ?>
                                        <p class="thumb-list-item-meta"><?php 
                        echo get_the_date();
                        ?>
</p>
                                    <?php 
                    }
                    ?>

                                    <h5 class="thumb-list-item-title"><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    get_the_title() ? the_title() : the_ID();
                    ?>
</a></h5>
                                    <p class="thumb-list-item-desciption"><?php 
                    echo TravelHelper::cutnchar(strip_tags(get_the_excerpt()), 50);
                    ?>
</p>
                                </div>
                            </li>

                        <?php 
                }
                ?>
                    </ul>
                    <?php 
                echo balanceTags($args['after_widget']);
                ?>
                    <?php 
                // Reset the global $the_post as this query will have stomped on it
                wp_reset_postdata();
            }
            if (!$this->is_preview()) {
                $cache[$args['widget_id']] = ob_get_flush();
                wp_cache_set($this->cache_key, $cache, 'widget');
            } else {
                ob_end_flush();
            }
        }
Example #3
0
    echo '<img width="800" height="600" alt="no-image" class="wp-post-image" src="' . bfi_thumb(get_template_directory_uri() . '/img/no-image.png', array('width' => 800, 'height' => 600)) . '">';
}
?>
            </div>
            <div class="col-md-6">
                <h5 class="booking-item-title">
                    <?php 
the_title();
?>
                </h5>
                <div class="text-small">
                    <p style="margin-bottom: 10px;">
                        <?php 
$excerpt = get_the_excerpt();
$excerpt = strip_tags($excerpt);
echo TravelHelper::cutnchar($excerpt, 120);
?>
                    </p>
                </div>
                <ul class="booking-item-features booking-item-features-sign clearfix">
                    <?php 
if ($adult = get_post_meta(get_the_ID(), 'adult_number', true)) {
    ?>
                        <li rel="tooltip" data-placement="top" title="" data-original-title="<?php 
    st_the_language('user_adults_occupancy');
    ?>
"><i class="fa fa-male"></i><span class="booking-item-feature-sign">x <?php 
    echo esc_html($adult);
    ?>
</span>
                        </li>
Example #4
0
 function _limit_short_description($e)
 {
     return TravelHelper::cutnchar($e, 200);
 }