示例#1
0
    public static function archive_card_sm(array $args = [])
    {
        global $post;
        $args = array_merge(['classes' => 'g-tablet-1-4', 'lazyload' => true, 'category' => true, 'target' => theme_functions::$link_target], $args);
        $args['classes'] .= ' card sm ';
        $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 <?php 
        post_class($args['classes']);
        ?>
>
			<div class="card-bg" >
				<?php 
        if (class_exists('theme_colorful_cats') && $args['category']) {
            ?>
					<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 
					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 
        }
        ?>
				</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>
					<time class="meta time" datetime="<?php 
        echo get_the_time('Y-m-d H:i:s', $post->ID);
        ?>
" title="<?php 
        echo get_the_time(___('M j, Y'), $post->ID);
        ?>
">
						<?php 
        echo friendly_date(get_the_time('U', $post->ID));
        ?>
					</time>
				</div>
			</div>
		</article>
		<?php 
    }
示例#2
0
    /**
     * candy 
     */
    public static function display_frontend_candy()
    {
        $boxes = self::get_boxes();
        if (!$boxes || count($boxes) < 2) {
            return false;
        }
        krsort($boxes);
        ?>
<div class="<?php 
        echo __CLASS__;
        ?>
-container <?php 
        echo __CLASS__;
        ?>
-candy">
<div class="area-overdely"></div>
<div class="area-blur">
	<?php 
        $i = 0;
        foreach ($boxes as $box) {
            ++$i;
            ?>
		<div class="item <?php 
            echo $i === 1 ? 'active' : null;
            ?>
" style="background-image:url(<?php 
            echo $box['img-url'];
            ?>
)"></div>
	<?php 
        }
        ?>
</div>
<div id="<?php 
        echo __CLASS__;
        ?>
" class="g">
	<div class="area-main">
		<?php 
        $i = 0;
        foreach ($boxes as $box) {
            ++$i;
            $rel_nofollow = isset($box['rel']['nofollow']) ? 'rel="nofollow"' : null;
            $target_blank = isset($box['target']['blank']) ? 'target="blank"' : null;
            $title = $box['title'];
            $subtitle = $box['subtitle'];
            $img_url = $box['img-url'];
            $link_url = $box['link-url'];
            ?>
			<div class="item <?php 
            echo $i === 1 ? 'active' : null;
            ?>
">
				<a 
					class="img" 
					href="<?php 
            echo $link_url;
            ?>
" 
					title="<?php 
            echo $title;
            ?>
" 
					<?php 
            echo $rel_nofollow;
            ?>
 
					<?php 
            echo $target_blank;
            ?>
 
				><img src="<?php 
            echo $img_url;
            ?>
" alt="<?php 
            echo $title;
            ?>
" width="<?php 
            echo self::$image_size[0];
            ?>
" height="<?php 
            echo self::$image_size[1];
            ?>
"></a>

				<a 
					class="des" 
					href="<?php 
            echo $link_url;
            ?>
" 
					title="<?php 
            echo $title;
            ?>
" 
					<?php 
            echo $rel_nofollow;
            ?>
 
					<?php 
            echo $target_blank;
            ?>
 
				>
					<span class="title"><?php 
            echo $title;
            ?>
</span>
					<?php 
            if ($subtitle !== '') {
                ?>
						<span class="sub-title"><?php 
                echo $subtitle;
                ?>
</span>
					<?php 
            }
            ?>

					<?php 
            /** colorful cat */
            if (isset($box['catids']) && !empty($box['catids']) && class_exists('theme_colorful_cats')) {
                ?>
						<span class="cats">
							<?php 
                foreach ($box['catids'] as $cat_id) {
                    $cat = theme_cache::get_category($cat_id);
                    $color = theme_colorful_cats::get_cat_color($cat_id, true);
                    ?>
								<span style="background-color:rgba(<?php 
                    echo $color['r'];
                    ?>
,<?php 
                    echo $color['g'];
                    ?>
,<?php 
                    echo $color['b'];
                    ?>
,.8);"><?php 
                    echo esc_html($cat->name);
                    ?>
</span>
							<?php 
                }
                ?>
						</span>
					<?php 
            }
            ?>
					<span class="more"><?php 
            echo ___('Detail &raquo;');
            ?>
</span>
				</a>
			</div>
		<?php 
        }
        ?>
	</div>
	<div class="area-thumbnail">
		<?php 
        $i = 0;
        foreach ($boxes as $box) {
            ++$i;
            $rel_nofollow = isset($box['rel']['nofollow']) ? 'rel="nofollow"' : null;
            $target_blank = isset($box['target']['blank']) ? 'target="blank"' : null;
            $title = $box['title'];
            $img_url = $box['img-url'];
            $link_url = $box['link-url'];
            ?>
			<a 
				class="item <?php 
            echo $i === 1 ? 'active' : null;
            ?>
" 
				href="<?php 
            echo $link_url;
            ?>
" 
				title="<?php 
            echo $title;
            ?>
" 
				<?php 
            echo $rel_nofollow;
            ?>
 
				<?php 
            echo $target_blank;
            ?>
 
			>
				<img src="<?php 
            echo $img_url;
            ?>
" alt="placeholder" width="<?php 
            echo self::$image_size[0];
            ?>
" height="<?php 
            echo self::$image_size[1];
            ?>
">
				<h2><?php 
            echo $title;
            ?>
</h2>
			</a>
		<?php 
        }
        ?>
	</div>
</div><!-- /#slidebox -->
</div><!-- /.slidebox-container -->
		<?php 
    }