예제 #1
0
    function widget($args, $instance)
    {
        // outputs the content of the widget
        global $kkLikeSettings;
        $i = 1;
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $items = esc_attr($instance['items']);
        $type = esc_attr($instance['type']);
        if ($type == 'all_post_types') {
            $type = FALSE;
        }
        $like = new kkDataBase();
        $posts = $like->getTopPosts($items, $type);
        echo $before_widget;
        echo $before_title;
        echo $title;
        echo $after_title;
        echo '<ul class="kklike-widget kklike-most-liked">';
        foreach ($posts as $post) {
            // if($i == '1'){
            // $cls = 'kklike-big-heart';
            // }else if($i == '2' || $i == '3'){
            // $cls = 'kklike-small-heart';
            // }else{
            // $cls = 'kklike-big-heart';
            // }
            $cls = 'kklike-big-heart';
            ?>
        	<li>
        		<span class="<?php 
            echo $cls;
            ?>
"></span>
        		<span class="kklike-wg-text">
        			<span class="kklike-wg-title"><a href="<?php 
            echo get_permalink($post->ID);
            ?>
"><?php 
            echo $post->post_title;
            ?>
</a></span>
        			<span class="kklike-wg-rating"><?php 
            echo __('Liked:', 'lang-kklike');
            ?>
 <?php 
            echo $post->meta_value;
            ?>
</span>
        			<span class="kklike-wg-date"><?php 
            echo __('Date:', 'lang-kklike');
            ?>
 <?php 
            echo date('d-m-Y', strtotime($post->post_date));
            ?>
</span>
        		</span>
        		<span class="kkclear"></span>
        	</li>
        <?php 
            $i++;
        }
        echo '</ul>';
        echo $after_widget;
    }
예제 #2
0
파일: admin.php 프로젝트: agileontheweb/xvp
    function kklike_most_liked_widget_function()
    {
        ?>
	 	<div class="kklike-list-box">
				<?php 
        $db = new kkDataBase();
        $dane = $db->getTopPosts('5');
        $numberLikes = $db->getLikesNumber();
        if (!empty($dane) && $numberLikes > 0) {
            $i = 1;
            foreach ($dane as $row) {
                $perc = floor($row->meta_value / $numberLikes * 100);
                ?>
						<div class="kklike-list-box-element kklike-stat">
							<div class="kklike-list-text" style="width: 100%;">
								<strong><span class=""><?php 
                echo $i;
                ?>
.</span> <a href="<?php 
                echo get_permalink($row->ID);
                ?>
" target="_blank"><?php 
                echo $row->post_title;
                ?>
</a></strong>.
							</div>
							<div class="kklike-likes"><?php 
                echo $row->meta_value . ' ' . __('likes', 'lang-kklike');
                ?>
</div>
							<div class="kklike-stat-bg" style="width: <?php 
                echo $perc;
                ?>
%;"></div>
							<div class="kkclear"></div>
						</div>
						<?php 
                $i++;
            }
        } else {
            ?>
					<div class="kklike-list-box-element">
						<div class="kklike-list-text">
							<?php 
            echo __('I\'m sorry, at this moment there are no data to display', 'lang-kklike');
            ?>
						</div>
						<div class="kkclear"></div>
					</div>
				<?php 
        }
        ?>
			</div>
			<?php 
    }