private static function get_views($post_id)
 {
     static $caches = [];
     if (!isset($caches[$post_id])) {
         $caches[$post_id] = (int) theme_post_views::get_views($post_id);
     }
     return $caches[$post_id];
 }
예제 #2
0
    public static function archive_card_lg(array $args = [])
    {
        global $post;
        $args = array_merge(['classes' => 'g-tablet-1-4', 'lazyload' => true, 'target' => theme_functions::$link_target], $args);
        $args['classes'] .= ' card lg ';
        $thumbnail_real_src = theme_functions::get_thumbnail_src($post->ID);
        $permalink = theme_cache::get_permalink($post->ID);
        $post_title = theme_cache::get_the_title($post->ID);
        $author_display_name = theme_cache::get_the_author_meta('display_name', $post->post_author);
        ?>
		<article class="<?php 
        echo $args['classes'];
        ?>
">
			<div class="card-bg" >
				<a 
					href="<?php 
        echo $permalink;
        ?>
" 
					title="<?php 
        echo $post_title;
        ?>
" 
					class="thumbnail-container" 
					target="<?php 
        echo $args['target'];
        ?>
" 
				>
					<?php 
        /**
         * lazyload img
         */
        if ($args['lazyload']) {
            ?>
						<img class="thumbnail" src="<?php 
            echo theme_functions::$thumbnail_placeholder;
            ?>
" data-src="<?php 
            echo $thumbnail_real_src;
            ?>
" alt="<?php 
            echo $post_title;
            ?>
" width="<?php 
            echo self::$thumbnail_size[1];
            ?>
" height="<?php 
            echo self::$thumbnail_size[2];
            ?>
" >
					<?php 
        } else {
            ?>
						<img class="thumbnail" src="<?php 
            echo $thumbnail_real_src;
            ?>
" alt="<?php 
            echo $post_title;
            ?>
" width="<?php 
            echo self::$thumbnail_size[1];
            ?>
" height="<?php 
            echo self::$thumbnail_size[2];
            ?>
" >
					<?php 
        }
        ?>

					<?php 
        if (class_exists('theme_colorful_cats')) {
            ?>
						<div class="card-cat">
							<?php 
            /**
             * cats
             */
            foreach (get_the_category($post->ID) as $cat) {
                $color = theme_colorful_cats::get_cat_color($cat->term_id, true);
                ?>
								<span style="background-color:rgba(<?php 
                echo $color['r'];
                ?>
,<?php 
                echo $color['g'];
                ?>
,<?php 
                echo $color['b'];
                ?>
,.8);"><?php 
                echo $cat->name;
                ?>
</span>
							<?php 
            }
            ?>
						</div>
					<?php 
        }
        ?>

				</a>
				<a 
					href="<?php 
        echo $permalink;
        ?>
" 
					title="<?php 
        echo $post_title;
        ?>
" 
					class="card-title" 
					target="<?php 
        echo $args['target'];
        ?>
" 
				>
					<h3><?php 
        echo $post_title;
        ?>
</h3>
				</a>
				<div class="card-meta">
					<a 
						href="<?php 
        echo theme_cache::get_author_posts_url($post->post_author);
        ?>
" 
						class="meta author" 
						title="<?php 
        echo $author_display_name;
        ?>
" 
						target="<?php 
        echo $args['target'];
        ?>
" 
					>
						<img width="32" height="32" src="<?php 
        echo theme_functions::$avatar_placeholder;
        ?>
" data-src="<?php 
        echo theme_cache::get_avatar_url($post->post_author);
        ?>
" alt="<?php 
        echo $author_display_name;
        ?>
" class="avatar"> <span class="tx"><?php 
        echo $author_display_name;
        ?>
</span>
					</a>
					<?php 
        /**
         * views
         */
        if (class_exists('theme_post_views') && theme_post_views::is_enabled()) {
            ?>
						<span class="meta views" title="<?php 
            echo ___('Views');
            ?>
"><i class="fa fa-play-circle"></i> <?php 
            echo theme_post_views::get_views($post->ID);
            ?>
</span>
					<?php 
        }
        ?>

					<!-- comments count -->
					<span class="meta comments-count" title="<?php 
        echo ___('Comments');
        ?>
">
						<i class="fa fa-comment"></i> <?php 
        echo (int) $post->comment_count;
        ?>
					</span>
				</div>
			</div>
		</article>
		<?php 
    }
예제 #3
0
    public static function widget_rank_img_content($args = [])
    {
        global $post;
        $args = array_merge(['classes' => '', 'lazyload' => true, 'excerpt' => false, 'target' => '_blank'], $args);
        $thumbnail_real_src = theme_functions::get_thumbnail_src($post->ID);
        $post_title = theme_cache::get_the_title($post->ID);
        ?>
		<li class="list-group-item <?php 
        echo $args['classes'];
        ?>
">
			<a 
				class="list-group-item-bg media" 
				href="<?php 
        echo theme_cache::get_permalink($post->ID);
        ?>
" 
				title="<?php 
        echo $post_title;
        ?>
" 
				target="<?php 
        echo $args['target'];
        ?>
" 
			>
				<div class="media-left">
					<div class="thumbnail-container">
						<img 
							class="thumbnail" 
							src="<?php 
        echo theme_functions::$thumbnail_placeholder;
        ?>
" 
							data-src="<?php 
        echo $thumbnail_real_src;
        ?>
" 
							alt="<?php 
        echo $post_title;
        ?>
" 
							width="<?php 
        echo theme_functions::$thumbnail_size[1];
        ?>
" 
							height="<?php 
        echo theme_functions::$thumbnail_size[2];
        ?>
" 
						>
					</div>
				</div>
				<div class="media-body">
					<h3 class="media-heading"><?php 
        echo $post_title;
        ?>
</h3>
					<div class="metas row">
						<?php 
        if (class_exists('theme_post_views') && theme_post_views::is_enabled()) {
            ?>
							<div class="view meta g-phone-1-2">
								<i class="fa fa-play-circle"></i> 
								<?php 
            echo theme_post_views::get_views();
            ?>
							</div>
						<?php 
        }
        ?>

						<div class="comments meta g-phone-1-2">
							<i class="fa fa-comment"></i> 
							<?php 
        echo (int) $post->comment_count;
        ?>
						</div>
					</div>
				</div>			
			</a>
		</li>
		<?php 
    }
예제 #4
0
    public static function display_frontend()
    {
        global $post;
        $meta = self::get_post_meta($post->ID);
        if (!$meta) {
            return;
        }
        ?>
		<a class="meta meta-post-storage" href="<?php 
        echo self::get_download_page_url($post->ID);
        ?>
" target="_blank" title="<?php 
        echo ___('Download');
        ?>
">
			<div id="post-storage-number-<?php 
        echo $post_id;
        ?>
" class="number">
				<?php 
        if (class_exists('theme_post_views') && theme_post_views::is_enabled()) {
            $number = (int) (theme_post_views::get_views($post_id) * 0.5 - mt_rand(1, 9));
            echo $number <= 0 ? 0 : number_format($number);
        }
        ?>
			</div>
			<div class="tx"><?php 
        echo ___('Download');
        ?>
</div>
		</a>
		<?php 
    }
예제 #5
0
                echo ___('Published');
                break;
            case 'pending':
                echo ___('Pending');
                break;
        }
        ?>
							</div>
						</td>
						<!-- views -->
						<?php 
        if (class_exists('theme_post_views') && theme_post_views::is_enabled()) {
            ?>
							<td class="edit-post-views">
								<?php 
            echo theme_post_views::get_views($post->ID);
            ?>
							</td>
						<?php 
        }
        ?>
					</tr>
					<?php 
    }
    ?>
				</tbody>
			</table>
		</div>
		<?php 
} else {
    ?>
예제 #6
0
    public static function rank_img_content($args = [])
    {
        global $post;
        $args = array_merge(['classes' => '', 'lazyload' => true, 'excerpt' => true, 'index' => false, 'target' => theme_functions::$link_target], $args);
        $post_title = theme_cache::get_the_title($post->ID);
        $excerpt = get_the_excerpt();
        if (!empty($excerpt)) {
            $excerpt = esc_html($excerpt);
        }
        $thumbnail_real_src = theme_functions::get_thumbnail_src($post->ID);
        ?>
		<div class="list-group-item <?php 
        echo $args['classes'];
        ?>
">
			<div class="row">
				<div class="g-tablet-1-6">
					<a href="<?php 
        echo theme_cache::get_permalink($post->ID);
        ?>
" title="<?php 
        echo $post_title;
        ?>
" target="<?php 
        echo $args['target'];
        ?>
" class="thumbnail-container">
						<?php 
        if ($args['lazyload'] === true) {
            ?>
							<img class="thumbnail" src="<?php 
            echo theme_functions::$thumbnail_placeholder;
            ?>
" data-src="<?php 
            echo $thumbnail_real_src;
            ?>
" alt="<?php 
            echo $post_title;
            ?>
" width="<?php 
            echo theme_functions::$thumbnail_size[1];
            ?>
" height="<?php 
            echo theme_functions::$thumbnail_size[2];
            ?>
">
						<?php 
        } else {
            ?>
							<img class="thumbnail" src="<?php 
            echo $thumbnail_real_src;
            ?>
" alt="<?php 
            echo $post_title;
            ?>
" width="<?php 
            echo theme_functions::$thumbnail_size[1];
            ?>
" height="<?php 
            echo theme_functions::$thumbnail_size[2];
            ?>
">
						<?php 
        }
        ?>
					</a>
				</div>
				<div class="g-tablet-5-6">
					<h3 class="media-heading">
						<a href="<?php 
        echo theme_cache::get_permalink($post->ID);
        ?>
" title="<?php 
        echo $post_title;
        ?>
" target="<?php 
        echo $args['target'];
        ?>
" ><?php 
        echo $post_title;
        ?>
</a>
					</h3>
					<?php 
        /**
         * output excerpt
         */
        if ($args['excerpt'] === true) {
            ?>
						<div class="excerpt"><?php 
            echo str_sub(strip_tags($excerpt), 200);
            ?>
</div>
					<?php 
        }
        ?>
					<div class="extra">
						<div class="metas row">
							<!-- author -->
							<a class="author meta g-phone-1-2 g-tablet-1-4 g-desktop-1-5" href="<?php 
        echo theme_cache::get_author_posts_url($post->post_author);
        ?>
" target="<?php 
        echo $args['target'];
        ?>
" >
								<img src="<?php 
        echo theme_functions::$avatar_placeholder;
        ?>
" data-src="<?php 
        echo theme_cache::get_avatar_url($post->post_author);
        ?>
" alt="avatar" width="16" height="16" class="avatar"> 
								<?php 
        echo theme_cache::get_the_author_meta('display_name', $post->post_author);
        ?>
							</a>
							
							<!-- category -->
							<div class="category meta g-phone-1-2 g-tablet-1-4 g-desktop-1-5">
								<?php 
        $cats = get_the_category_list('<i class="split"> / </i> ');
        if (!empty($cats)) {
            ?>
									<i class="fa fa-folder-open"></i> 
									<?php 
            echo $cats;
            ?>
								<?php 
        }
        ?>
							</div>

							<!-- views -->
							<?php 
        if (class_exists('theme_post_views') && theme_post_views::is_enabled()) {
            ?>
								<div class="view meta g-phone-1-2 g-tablet-1-4 g-desktop-1-5">
									<i class="fa fa-play-circle"></i> 
									<?php 
            echo theme_post_views::get_views();
            ?>
								</div>
							<?php 
        }
        ?>

							<?php 
        if (!wp_is_mobile()) {
            ?>
								<div class="comments meta g-phone-1-2 g-tablet-1-4 g-desktop-1-5">
									<i class="fa fa-comment"></i> 
									<?php 
            echo (int) $post->comment_count;
            ?>
								</div>
							<?php 
        }
        ?>
							
							<?php 
        /**
         * point
         */
        if (class_exists('custom_post_point')) {
            ?>
								<div class="point meta g-phone-1-2 g-tablet-1-4 g-desktop-1-5">
									<i class="fa fa-paw"></i>
									<?php 
            echo (int) custom_post_point::get_post_points_count($post->ID);
            ?>
								</div>
								<?php 
        }
        ?>


						</div><!-- /.metas -->
					</div>
					<?php 
        if ($args['index']) {
            ?>
						<i class="index"><?php 
            echo $args['index'];
            ?>
</i>
					<?php 
        }
        ?>
					
				</div>
			</div>
		</div>
		<?php 
    }