/** * Display Video Meta as Viewed, Liked */ function mars_video_meta() { global $post, $videotube; $viewed = get_post_meta($post->ID, 'count_viewed', true) ? get_post_meta($post->ID, 'count_viewed', true) : 1; $datetime_format = isset($videotube['datetime_format']) ? $videotube['datetime_format'] : 'videotube'; $comments = wp_count_comments($post->ID); $block = ' <div class="meta">'; if ($datetime_format != 'videotube') { $block .= '<span class="date">' . the_date('', '', '', false) . '</span>'; } else { $block .= '<span class="date">il y a ' . human_time_diff(get_the_time('U'), current_time('timestamp')) . '</span>'; } $block .= ' <span class="views"><i class="fa fa-eye"></i>' . $viewed . '</span>'; if (function_exists('mars_get_like_count')) { $block .= '<span class="heart"><i class="fa fa-heart"></i>' . mars_get_like_count($post->ID) . '</span>'; } $block .= ' <span class="fcomments"><i class="fa fa-comments"></i>' . $comments->approved . '</span> '; $block .= ' </div> '; return $block; }
function modify_column($column, $post_id) { switch ($column) { case 'user': $video = get_post($post_id); print get_avatar($video->post_author, 64); break; case 'likes': print mars_get_like_count($post_id); break; case 'views': print mars_get_count_viewed(); break; case 'layout': $layout = get_post_meta($post_id, 'layout', true) ? get_post_meta($post_id, 'layout', true) : 'small'; print $layout; break; } }
?> class="option likes-dislikes" href="javascript:void(0)" action="like" id="<?php print $post->ID; ?> " id="buttonlike" video="<?php print $post->ID; ?> "> <i class="fa fa-thumbs-up"></i> <span class="option-text likes-dislikes"> <label class="likevideo<?php print $post->ID; ?> "><?php if (function_exists('mars_get_like_count')) { print mars_get_like_count($post->ID); } ?> </label> </span> </a> <?php if ($guestlike == 0 && !get_current_user_id()) { ?> <!-- Login Modal --> <div class="modal fade" id="loginmodal" tabindex="-1" role="dialog" aria-labelledby="loginmodal-label" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="loginmodal-label"><?php
function mars_add_1firstlike($post_id) { if (get_post_type($post_id) == 'video') { $likes = mars_get_like_count($post_id); if ($likes == 0 || !$likes) { update_post_meta($post_id, 'like_key', 1); } } }