function parse_tm_related_post_func($atts, $content) { $postformat = isset($atts['postformat']) ? $atts['postformat'] : ''; $posttypes = isset($atts['posttypes']) ? $atts['posttypes'] : 'post'; $count = isset($atts['count']) ? $atts['count'] : -1; $tags = isset($atts['tag']) ? $atts['tag'] : ''; $orderby = isset($atts['orderby']) ? $atts['orderby'] : ''; global $post; if (is_single()) { if ($tags == '') { $tags = ''; $posttags = get_the_tags(); if ($posttags) { foreach ($posttags as $tag) { $tags .= ',' . $tag->slug; } $tags = substr($tags, 1); } } } $args = array('taxonomy' => 'post_format', 'post_type' => $posttypes, 'posts_per_page' => $count, 'post_status' => 'publish', 'posts_not_in' => array(get_the_ID($post)), 'terms' => array($postformat), 'tag' => $tags); $the_query = new WP_Query($args); if ($the_query->have_posts()) { $html = '<div class="popular_video ">'; while ($the_query->have_posts()) { $the_query->the_post(); $html .= ' <div class="row-fluid"> <div class="rt-article span12"> <div class="popular_video_item"> <div class="video_thumb"> <a href="#">' . get_the_post_thumbnail(get_the_ID(), array(150, 150)) . ' <span class="link-overlay fa fa-play"></span></a> ' . tm_post_rating(get_the_ID()) . ' </div> <div class="pp_info"> <h4 class="rt-article-title"> <a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_title() . '</a></h4> <div class="pp_video_view"><span><i class="icon-eye-open"></i> ' . tm_get_post_views() . '' . __(' Views') . '</span></div> <div class="pp_video_comment"><span><i class="icon-comment"></i> ' . get_comments_number() . '' . __(' Comments') . '</span></div> <div class="pp_video_like"><span><i class="icon-heart"></i> ' . tm_get_post_likes(get_the_ID()) . ' ' . __(' Likes') . '</span></div> </div> <!-- end post wrap --> <div class="clear"><!-- --></div> </div> </div> <!-- end span --> </div> '; } } $html .= ' </div> <div class="clear"></div> '; wp_reset_query(); return $html; }
function tm_get_posts_likes($pid = '') { global $post; if (!$pid) { $pid = $post->ID; } if (!$pid) { return; } $likes = sprintf(__('%s <span class="suffix">Likes</span>', 'dp'), '<i class="count" data-pid="' . $pid . '">' . tm_get_post_likes($pid) . '</i>'); $liked = tm_is_user_liked_post($pid) ? ' liked' : ''; $stats .= '<span class="dp-post-likes likes' . $liked . '">' . $likes . '</span>'; return $stats; }