Пример #1
0
 /**
  * Get all cat ID by children cat id
  *
  * @param int $cat_id Current children cat id
  * @param array &$all_cat_id All cats id
  * @return 
  * @version 1.0.0
  */
 public static function get_all_cats_by_child($cat_id, array &$all_cat_id)
 {
     $cat = theme_cache::get_category($cat_id);
     if (!$cat) {
         return false;
     }
     $all_cat_id[] = $cat_id;
     if ($cat->parent != 0) {
         return self::get_all_cats_by_child(get_category($cat->parent)->term_id, $all_cat_id);
     }
 }
Пример #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 
    }