function widget($args, $instance)
 {
     global $post;
     extract(array_merge(array('title' => '', 'number_posts' => 4, 'exclude_posts' => '', 'thumb' => 'thumb'), $instance));
     $q['posts_per_page'] = $number_posts;
     $q['ignore_sticky_posts'] = 1;
     $q['category__not_in'] = explode(',', $exclude_posts);
     query_posts($q);
     if (isset($before_widget)) {
         echo $before_widget;
     }
     echo '<aside class="widget tt_recent_posts tt-widget">';
     if ($title != '') {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     echo '<ul>';
     while (have_posts()) {
         the_post();
         echo '<li>';
         $comments = wp_count_comments($post->ID);
         if ($thumb == 'date') {
             echo '<span class="widget-thumb post-date">
                 <span class="day">' . get_the_date('d') . '</span>
                 <span class="month">' . date_i18n('M', strtotime(get_the_date("Y-m-d"))) . '</span>
             </span>';
         } else {
             echo '<span class="widget-thumb">';
             if (has_post_thumbnail()) {
                 the_post_thumbnail(array(40, 40));
             } else {
                 echo '<span class="entry-format"></span>';
             }
             echo '</span>';
         }
         echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>';
         echo '<ul class="list-inline">
                 <li><a href="#" title=""><i class="fa fa-comments"></i> ' . $comments->total_comments . '</a></li>
                 <li class="meta-like">' . get_post_like(get_the_ID()) . '</li>
               </ul>';
         echo '</li>';
     }
     echo '</ul>';
     echo '</aside>';
     if (isset($after_widget)) {
         echo $after_widget;
     }
     wp_reset_query();
 }
 function widget($args, $instance)
 {
     global $post;
     extract(array_merge(array('title' => '', 'number_posts' => 4, 'post_type' => 'post'), $instance));
     $q['posts_per_page'] = $number_posts;
     $q['paged'] = 1;
     $q['meta_key'] = '_post_like';
     $q['orderby'] = 'meta_value_num';
     $q['order'] = 'DESC';
     $q['ignore_sticky_posts'] = 1;
     query_posts($q);
     if (isset($before_widget)) {
         echo $before_widget;
     }
     echo '<aside class="widget tt_recent_posts tt-widget tt-most-liked">';
     if ($title != '') {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     echo '<ul>';
     while (have_posts()) {
         the_post();
         $comments = wp_count_comments($post->ID);
         $likes = blox_getmeta(get_the_ID(), 'post_like');
         echo '<li>';
         echo '<span class="widget-thumb">' . $likes . '</span>';
         echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>';
         echo '<ul class="list-inline">
                 <li class="tt-widget-comments-number"><a href="#" title=""><i class="fa fa-comments"></i> ' . $comments->total_comments . '</a></li>
                 <li class="tt-widget-likes-number meta_like">' . get_post_like(get_the_ID()) . '</li>
               </ul>';
         echo '</li>';
     }
     echo '</ul>';
     echo '</aside>';
     if (isset($after_widget)) {
         echo $after_widget;
     }
     wp_reset_query();
 }
Example #3
0
?>
	</div>
	<!-- END header -->

	<!-- BEGIN content -->
	<div class="post-single-content">
		<div class="container">
			<div class="content">
				<?php 
the_content();
?>
			</div>
			<div class="post-footer">
				<div class="post-statistic">
					<?php 
echo get_post_like(get_the_ID());
?>
					<span class="views"><svg><use xlink:href="#views" /></svg><span><?php 
if (function_exists('get_views_count')) {
    echo get_views_count(get_the_ID());
}
?>
</span></span>
				</div>
				<?php 
sergeymotovilets_entry_footer($post->ID);
?>
			</div><!-- .entry-footer -->

			<!-- BEGIN Related posts -->
			<?php 
Example #4
0
function blox_loop_portfolio($options)
{
    $options = array_merge(array('item_style' => 'default', 'overlay' => 'none', 'thumb' => '', 'class' => '', 'width' => '', 'height' => ''), $options);
    global $post;
    $excerpt_html = '';
    if ($options['item_style'] == 'with_excerpt') {
        $excerpt_html = '<div class="entry-content"><p>' . wp_trim_words(wp_strip_all_tags(do_shortcode(get_the_content())), 20) . '</p></div>';
    }
    $result = '';
    $alt = 'Portfolio Image';
    if ($options['item_style'] == 'alternative') {
        $result = '<div class="post_filter_item ' . $options['class'] . '">
                        <article itemscope itemtype="http://schema.org/BlogPosting" class="entry hover">
                            <div class="entry-media">
                                <div class="entry-hover">
                                    <div class="relative">
                                        <div class="entry-title">
                                            <h2 itemprop="headline">
                                                <a itemprop="url" href="' . get_permalink() . '">' . get_the_title() . '</a>
                                            </h2>
                                        </div>
                                        <ul class="entry-meta list-inline">
                                            <li itemprop="datePublished" class="meta-date">' . date_i18n(get_option('date_format'), strtotime(get_the_date())) . '</li>
                                            <li class="meta-like">' . get_post_like(get_the_ID()) . '</li>
                                        </ul>
                                    </div>
                                </div>
                                <img itemprop="image" src="' . $options['thumb'] . '" alt="' . $alt . '" class="img-responsive" />
                            </div>
                        </article>
                    </div>';
    } else {
        $hover_args = array('overlay' => $options['overlay']);
        if ($options['height'] != '') {
            $hover_args = array_merge(array('width' => $options['width'], 'height' => $options['height']), $hover_args);
        }
        $entry_media = hover_featured_image($hover_args);
        $entry_media = tt_getmeta('portfolio_gallery') != '' ? blox_portfolio_gallery($options) : $entry_media;
        $result = '<div class="post_filter_item ' . $options['class'] . '">
                        <article itemscope itemtype="http://schema.org/BlogPosting" class="entry">
                            ' . $entry_media . '
                            <div class="relative">
                                <div class="entry-title">
                                    <h2 itemprop="headline">
                                        <a itemprop="url" href="' . get_permalink() . '">' . get_the_title() . '</a>
                                    </h2>
                                </div>
                                ' . $excerpt_html . '
                                <ul class="entry-meta list-inline">
                                    <li itemprop="datePublished" class="meta-date">' . date_i18n(get_option('date_format'), strtotime(get_the_date())) . '</li>
                                    <li class="meta-like">' . get_post_like(get_the_ID()) . '</li>
                                </ul>
                            </div>
                        </article>
                    </div>';
    }
    return $result;
}
Example #5
0
    function tt_related_posts($options = array())
    {
        $options = array_merge(array('per_page' => '3'), $options);
        global $post, $smof_data;
        $args = array('post__not_in' => array($post->ID), 'posts_per_page' => $options['per_page']);
        $grid_class = 'col-md-4 col-sm-6 col-xs-12';
        $post_type_class = 'blog';
        $categories = get_the_category($post->ID);
        if ($categories) {
            $category_ids = array();
            foreach ($categories as $individual_category) {
                $category_ids[] = $individual_category->term_id;
            }
            $args['category__in'] = $category_ids;
        }
        // For portfolio post and another than Post
        if ($post->post_type != 'post') {
            $tax_name = 'portfolio_entries';
            //should change it to dynamic and for any custom post types
            $args['post_type'] = get_post_type(get_the_ID());
            $args['tax_query'] = array(array('taxonomy' => $tax_name, 'field' => 'id', 'terms' => wp_get_post_terms($post->ID, $tax_name, array('fields' => 'ids'))));
            if ($options['per_page'] == '4') {
                $grid_class = 'col-md-3 col-sm-6 col-xs-12';
            }
            $post_type_class = 'portfolio';
        }
        if (isset($args)) {
            $my_query = new wp_query($args);
            if ($my_query->have_posts()) {
                $html = '';
                while ($my_query->have_posts()) {
                    $my_query->the_post();
                    $html .= '<div class="' . $grid_class . ' loop-item">
                                <article itemscope="" itemtype="http://schema.org/BlogPosting" class="entry">
                                    ' . hover_featured_image(array('overlay' => 'permalink')) . '

                                    <div class="relative">
                                        <div class="entry-title">
                                            <h2 itemprop="headline">
                                                <a itemprop="url" href="' . get_permalink() . '">' . get_the_title() . '</a>
                                            </h2>
                                        </div>
                                        <ul class="entry-meta list-inline">
                                            <li itemprop="datePublished" class="meta-date">' . date_i18n(get_option('date_format'), strtotime(get_the_date())) . '</li>
                                            <li class="meta-like">' . get_post_like(get_the_ID()) . '</li>
                                        </ul>
                                    </div>
                                </article>
                            </div>';
                }
                echo '<div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <h3 class="related-posts">' . __('Related Posts', 'themeton') . '</h3>
                        <div class="blox-element related-posts ' . $post_type_class . ' grid-loop">
                            <div class="row">
                                <div class="loop-container">' . $html . '</div>
                            </div>
                        </div>
                    </div>
                  </div>';
            }
        }
        wp_reset_query();
    }